public ActionResult Create(ManagerCreateModel model)
 {
     if (ModelState.IsValid)
     {
         var managerDto = new ManagerDto {
             LastName = model.LastName
         };
         var operationDetails = _managerService.Create(managerDto);
         if (operationDetails.Succedeed)
         {
             return(RedirectToAction("Index", "Manager"));
         }
         ModelState.AddModelError(operationDetails.Property, operationDetails.Message);
     }
     return(View(model));
 }
        public IActionResult Register([FromBody] RegisterModel model)
        {
            // map model to entity
            var user = _mapper.Map <Manager>(model);

            try
            {
                // create user
                _userService.Create(user, model.Password);
                return(Ok());
            }
            catch (AppException ex)
            {
                // return error message if there was an exception
                return(BadRequest(new { message = ex.Message }));
            }
        }
Exemplo n.º 3
0
 public async Task <Result> Create(int nationalSocietyId, [FromBody] CreateManagerRequestDto createManagerRequestDto) =>
 await _managerService.Create(nationalSocietyId, createManagerRequestDto);