public virtual async Task <IActionResult> CreateUser([FromBody] User user) { LogEnter("CreateUser", user); IActionResult result; if (TryValidateModel(user)) { MemberEntity member = _mapper.Map <MemberEntity>(user); if (member != null) { var newMember = await _repo.CreateMemberAsync(member); result = CreatedAtAction(nameof(ShowUserById), new { id = newMember.Id }); } else { result = BadRequest(); } } else { result = BadRequest(); } LogExit("CreateUser", result); return(result); }
public async Task <IActionResult> Create([FromForm] Member member) { if (ModelState.IsValid) { await _repository.CreateMemberAsync(member); return(RedirectToAction(nameof(Index))); } return(View(member)); }
public async Task <ActionResult> Create(Member member) { if (ModelState.IsValid) { await _repo.CreateMemberAsync(member); return(RedirectToAction("Index")); } return(View(member)); }
public async Task <IActionResult> AddMember([FromForm] Member member) { if (ModelState.IsValid) { await _memberRepository.CreateMemberAsync(member); await _welcomeMail.SendWelcomeEmail(member.Email, member.FirstName); return(View("MemberAdded")); } return(View(member)); }
public async Task <ActionResult <int> > CreateMember(MemberProfile member) { var result = await _repository.CreateMemberAsync(member); return(Ok(result)); }