internal static String Save(DB.ITM_BOM_Recipe entry, DataContext dataContext) { try { if (dataContext.EntityInventoryContext.GetEntityState(entry) == EntityState.Detached) { dataContext.EntityInventoryContext.ITM_BOM_Recipe.Add(entry); } Validation.ValidateEntity(dataContext.EntityInventoryContext, entry); } catch (Validation.EntityValidationException ex) { return(dataContext.PackageValidationException()); } return("Success"); }
public static DB.ITM_BOM_Recipe GetPreviousItem(DB.ITM_BOM_Recipe itm_bom_recipe, DataContext dataContext) { return(dataContext.EntityInventoryContext.ITM_BOM_Recipe.OrderByDescending(o => o.Id).Where(n => n.Id == itm_bom_recipe.Id && n.Id < itm_bom_recipe.Id).FirstOrDefault()); }