public void DeleteEquipmentJournal(LimsEquipmentJournalRecord entityToDelete) { if (AppContext.Entry(entityToDelete).State == EntityState.Detached) { AppContext.LimsEquipmentJournalRecords.Attach(entityToDelete); } var entToDelete = entityToDelete as ISoftDeleteEntity; if (entToDelete != null) { entToDelete.DeleteDate = DateTime.Now; UpdateEquipmentJournalRecords(entityToDelete); } else { AppContext.LimsEquipmentJournalRecords.Remove(entityToDelete); } }
public ActionResult DestroyEquipmentJournalRecord([DataSourceRequest] DataSourceRequest request, LimsEquipmentJournalRecord model) { if (model != null) { EquipmentJournalRepository eRepository = new EquipmentJournalRepository(false); eRepository.DeleteEquipmentJournalRecord(model.Id); eRepository.Save(); } return(Json(new[] { model }.ToDataSourceResult(request, ModelState))); }
public ActionResult UpdateEquipmentJournalRecord([DataSourceRequest] DataSourceRequest request, LimsEquipmentJournalRecord model) { if (ModelState.IsValid) { EquipmentJournalRepository eRepository = new EquipmentJournalRepository(false); eRepository.UpdateEquipmentJournalRecords(model); eRepository.Save(); } return(Json(new[] { model }.ToDataSourceResult(request, ModelState))); }
public ActionResult CreateEquipmentJournalRecord([DataSourceRequest] DataSourceRequest request, [Bind(Exclude = "Id")] LimsEquipmentJournalRecord model) { if (ModelState.IsValid) { EquipmentJournalRepository eRepository = new EquipmentJournalRepository(false); model.Id = Guid.NewGuid(); model.CreateDate = DateTime.Now; eRepository.InsertEquipmentJournalRecord(model); eRepository.Save(); } return(Json(new[] { model }.ToDataSourceResult(request, ModelState))); }
public void InsertEquipmentJournalRecord(LimsEquipmentJournalRecord entity) { AppContext.LimsEquipmentJournalRecords.Add(entity); }
public virtual void UpdateEquipmentJournalRecords(LimsEquipmentJournalRecord entityToUpdate) { AppContext.LimsEquipmentJournalRecords.Attach(entityToUpdate); AppContext.Entry(entityToUpdate).State = EntityState.Modified; }
public void DeleteEquipmentJournalRecord(object id) { LimsEquipmentJournalRecord entityToDelete = AppContext.LimsEquipmentJournalRecords.Find(id); DeleteEquipmentJournal(entityToDelete); }