public JsonResult ConfirmOrderTmc(LimsTmcOutView outCount) { OrderTmcRepository repository = new OrderTmcRepository(false); // берем у ТМЦ var ownerId = outCount.OwnerEmployeeId; if (outCount.OwnerEmployeeId == null) { var tmcRepo = new TmcRepository(false); ownerId = tmcRepo.GetAsQuarable(t => t.Id == outCount.TmcId).Select(t => t.OwnerEmployeeId).FirstOrDefault(); } TmcOut tmcOut = new TmcOut() { Id = Guid.NewGuid(), Note = outCount.Note, CreatedDate = DateTime.Now, CreatedEmployeeId = UserHelper.GetCurrentEmployee().Id, StateType = TmcOut.TmcOutStatuses.Ordered, OwnerEmployeeId = ownerId, OutTypeDicId = outCount.OutTypeDicId }; repository.Insert(tmcOut); TmcOutCount tmcOutCount = new TmcOutCount() { Id = Guid.NewGuid(), TmcId = outCount.TmcId, Count = outCount.Count, Note = outCount.Note, TmcOutId = tmcOut.Id }; repository.TocInsert(tmcOutCount); repository.Save(); return(Json(outCount.TmcId, JsonRequestBehavior.AllowGet)); }
public ActionResult CreateRequestChildrens([DataSourceRequest] DataSourceRequest request, TmcOutCountViewModel dictionary) { TmcOutCount tmc = new TmcOutCount() { Id = Guid.NewGuid(), StateType = dictionary.StateType, Note = dictionary.Note, CountFact = dictionary.CountFact, Count = dictionary.Count, TmcOutId = Guid.Parse(dictionary.TmcOutIdString) }; if (dictionary.TmcId != null) { tmc.TmcId = dictionary.TmcId.Value; } db.TmcOutCounts.Add(tmc); db.SaveChanges(); dictionary.Id = tmc.Id; return(Json(new[] { dictionary }.ToDataSourceResult(request, ModelState))); }
public void TocUpdate(TmcOutCount entityToUpdate) { TmcOutCountSet.Attach(entityToUpdate); AppContext.Entry(entityToUpdate).State = EntityState.Modified; }
public void TocDelete(object id) { TmcOutCount entityToDelete = TmcOutCountSet.Find(id); TocUpdate(entityToDelete); }
public void TocInsert(TmcOutCount entity) { TmcOutCountSet.Add(entity); }