public async Task UpdateASMasterCategory(ASMasterCategory objADMasterCategory) { try { _Context.Entry(objADMasterCategory).State = EntityState.Modified; await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task InsertASMasterCategory(ASMasterCategory objADMasterCategory) { try { _Context.ASMasterCategories.Add(objADMasterCategory); await _Context.SaveChangesAsync(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task <ActionResult <MasterCategoryResult> > PutASMasterCategory(long id, ASMasterCategory objADMasterCategory) { _logger.LogError("Done PutASMasterCategory -- Aniruddha Pakhale"); if (id != objADMasterCategory.MasterCategoryId) { return(BadRequest()); } try { await _IMasterCategoryInterface.UpdateASMasterCategory(objADMasterCategory); return(_IMasterCategoryInterface.GetASMasterCategoryByID(id)); } catch (DbUpdateConcurrencyException) { if (!_IMasterCategoryInterface.ASMasterCategoryExists(id)) { return(NotFound()); } else { throw; } } catch (Exception ex) { _logger.LogError(ex.Message); throw new Exception(ex.Message); } return(NoContent()); }
public async Task <ActionResult <MasterCategoryResult> > PostASMasterCategory(ASMasterCategory objADMasterCategory) { try { await _IMasterCategoryInterface.InsertASMasterCategory(objADMasterCategory); return(CreatedAtAction("GetASMasterCategory", new { id = objADMasterCategory.MasterCategoryId }, objADMasterCategory)); } catch (Exception ex) { _logger.LogError(ex.Message); throw new Exception(ex.Message); } }