public async Task <ActionResult <MasterGenderResult> > PostADMasterGender(ADMasterGender objADMasterGender) { try { await _IMasterGenderInterface.InsertADMasterGender(objADMasterGender); return(CreatedAtAction("GetADMasterGender", new { id = objADMasterGender.MasterGenderId }, objADMasterGender)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task InsertADMasterGender(ADMasterGender objADMasterGender) { try { _Context.ADMasterGenders.Add(objADMasterGender); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task UpdateADMasterGender(ADMasterGender objADMasterGender) { try { _Context.Entry(objADMasterGender).State = Microsoft.EntityFrameworkCore.EntityState.Modified; await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task DeleteADMasterGender(long MasterGenderId) { try { ADMasterGender objADMasterGender = _Context.ADMasterGenders.Find(MasterGenderId); _Context.ADMasterGenders.Remove(objADMasterGender); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult <MasterGenderResult> > PutADMasterGender(long id, ADMasterGender objADMasterGender) { if (id != objADMasterGender.MasterGenderId) { return(BadRequest()); } try { await _IMasterGenderInterface.UpdateADMasterGender(objADMasterGender); return(_IMasterGenderInterface.GetADMasterGenderByID(id)); } catch (DbUpdateConcurrencyException) { if (!_IMasterGenderInterface.ADMasterGenderExists(id)) { return(NotFound()); } else { throw; } } catch (Exception ex) { throw new Exception(ex.Message); } return(NoContent()); }