public bool DeleteGrainInvStorageLocation(int GrainInvStorageLocationId) { bool isSaved = true; using (WTCCeresEntities db = new WTCCeresEntities()) { try { gisl = db.GrainInvStorageLocation.Find(GrainInvStorageLocationId); db.GrainInvStorageLocation.Remove(gisl); db.SaveChanges(); } catch (Exception e) { var msg = e.Message; isSaved = false; } } return(isSaved); }
public bool UpdateGrainInvStorageLocation(int GrainInvStorageLocationId, int GrainInventoryId, int StorageTypeId, int StorageId, double Quantity) { bool isSaved = true; using (WTCCeresEntities db = new WTCCeresEntities()) { try { gisl = db.GrainInvStorageLocation.Find(GrainInvStorageLocationId); gisl.GrainInventoryId = GrainInventoryId; gisl.StorageTypeId = StorageTypeId; gisl.StorageId = StorageId; gisl.Quantity = Quantity; db.GrainInvStorageLocation.AddOrUpdate(gisl); db.SaveChanges(); } catch (Exception e) { var msg = e.Message; isSaved = false; } } return(isSaved); }