public static CompanyItem Get(entitiesEvolveCentral ctx, int id) { var item = new CompanyItem(); item = (from i in ctx.CompanyItems where i.Id == id orderby i.Name ascending select i).FirstOrDefault(); return(item); }
public static bool Delete(entitiesEvolveCentral ctx, CompanyItem item) { bool retval = true; try { ctx.CompanyItems.Remove(item); ctx.SaveChanges(); } catch (Exception ex) { ApplicationLog.Log(ctx, "DAL.Company.Delete(entitiesEvolveCentral ctx, CompanyItem item)", ex.Message); retval = false; } return(retval); }
public static bool Save(entitiesEvolveCentral ctx, CompanyItem item) { try { if (item.Id == 0) { ctx.CompanyItems.Add(item); } ctx.SaveChanges(); } catch (Exception ex) { return(false); } return(true); }