public bool InactivateDivision(PhytoDivision item) { bool result = false; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { Phyto_Division efItem = context.Phyto_Division.Where(b => b.DivisionID == item.DivisionID).FirstOrDefault(); if (efItem == null) { return(result); } efItem.DivisionActive = false; if (context.SaveChanges() > 0) { result = true; } } } catch (Exception) { } return(result); }
public int CreateDivision(PhytoDivision item) { byte newid; try { using (RCID_DWHEntities context = new RCID_DWHEntities()) { newid = context.Phyto_Division.OrderByDescending(u => u.DivisionID).FirstOrDefault().DivisionID; newid++; Phyto_Division efItem = new Phyto_Division() { DivisionID = newid, DivisionActive = item.DivisionActive, DivisionName = item.DivisionName, DivisionCommonName = item.DivisionCommonName }; context.Phyto_Division.Add(efItem); if (context.SaveChanges() > 0) { return(newid); } } } catch (Exception e) { throw e; } return(newid); }