public async Task <IActionResult> Create(CreateMemberTaskCommand command) { //return Ok(); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var result = await _tasksService.CreateMemberTaskCommandHandler(command); return(Created($"/api/members/{result.Payload.Id}", result)); }
public async Task <CreateMemberTasksCommandResult> CreateMemberTaskCommandHandler(CreateMemberTaskCommand command) { var member_task = _mapper.Map <Domain.DataModels.Task>(command); var persistedMember = await _taskRepository.CreateRecordAsync(member_task); //var vm = _mapper.Map<MemberTasksVm>(persistedMember); MemberTasksVm vm = new MemberTasksVm(); vm.AssignedToId = persistedMember.AssignedToId; vm.Subject = persistedMember.Subject; vm.Id = persistedMember.Id; vm.IsComplete = persistedMember.IsComplete; return(new CreateMemberTasksCommandResult() { Payload = vm }); }