This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package FirstLab | |
object Application{ | |
def main(args: Array[String]):Unit={ | |
println("List:"); | |
val list = List(1,2,3,4,5,6,7,8,9,10); | |
printList(list); | |
println(); | |
println("Recursive func:") | |
printList(recursive(list)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class DecoratorFactory { | |
public createWithCallback(func: Function, callback: any) { | |
if (!callback || typeof (callback) !== "function") | |
return undefined; | |
return function () { | |
const result = func.apply(this, arguments); // (*) | |
callback(); | |
return result; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ControllerExtensions | |
{ | |
public static void GetErrors(this Controller controller, object model, OperationResult result) | |
{ | |
if (model == null) | |
{ | |
result.Errors.Add("Ошибка ввода данных"); | |
} | |
result.Errors.AddRange(controller.ModelState.Values.SelectMany(v => v.Errors | |
.Where(b => !string.IsNullOrEmpty(b.ErrorMessage)) |
NewerOlder