public IHttpActionResult UpdateLookUpValue(ModelForMasters.CategoryLU data) { if (data != null) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var record = this.PortalEntities.Categories.Where(x => x.CID == data.CID).First(); record.CatgDesc = data.CatgDesc; record.CatgCode = data.CatgCode; record.DeptDID = data.DeptDID; try { this.PortalEntities.SaveChanges(); } catch (DbUpdateConcurrencyException) { throw; } } return(Ok(data)); }
public IHttpActionResult DeleteLookUpValue(ModelForMasters.CategoryLU data) { var record = this.PortalEntities.Categories.Where(x => x.CID == data.CID).First(); if (record == null) { return(NotFound()); } this.PortalEntities.Categories.Remove(record); this.PortalEntities.SaveChanges(); return(Ok(record)); }
public IHttpActionResult SaveLookUpValue(ModelForMasters.CategoryLU data) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } base.PortalEntities.Categories.Add(new Category { CID = data.CID, CatgCode = data.CatgCode, CatgDesc = data.CatgDesc, DeptDID = data.DeptDID }); base.PortalEntities.SaveChanges(); return(Ok(data)); }