public async Task <bool> AddGender(GenderParameter genderName) { var gender = Mapper.Map <GenderParameter, Gender>(genderName); UnitOfWork.Repo.Add(gender); return(await UnitOfWork.SaveChanges() > 0); }
public async Task <IActionResult> Create(GenderParameter gender) { if (ModelState.IsValid) { var isCreated = await _genderBusiness.AddGender(gender); if (isCreated) { return(RedirectToAction("Index")); } } return(View(gender)); }
public async Task <IActionResult> AddGender([FromBody] GenderParameter gender) { if (ModelState.IsValid) { var isAdded = await _genderBusiness.AddGender(gender); if (isAdded) { return(Ok("Saved Successfully")); } } return(BadRequest(ModelState)); }
public async Task <IActionResult> AddGender([FromBody] GenderParameter gender) { try { var isAdded = await _genderBusiness.AddGender(gender); if (isAdded) { return(Ok("Saved Successfully")); } return(NoContent()); } catch (Exception e) { return(BadRequest(e.Message)); } }