public ActionResult NewTaskPost(CreateTaskInput input) { if (!ModelState.IsValid) { throw new ArgumentException("input Is Valid", input.GetType().FullName); } _taskAppService.CreateTask(input); return Json("OK"); }
public void CreateTask(CreateTaskInput input) { //We can use Logger, it's defined in ApplicationService class. Logger.Info("Creating a task for input: " + input); //Creating a new Task entity with given input's properties var task = new Task { Description = input.Description }; if (input.AssignedPersonId.HasValue) { task.AssignedPerson = _personRepository.Load(input.AssignedPersonId.Value); } //Saving entity with standard Insert method of repositories. _taskRepository.Insert(task); }