public ActionResult DestroyTmcListFirst([DataSourceRequest] DataSourceRequest request, TmcView dictionary) { if (dictionary != null) { TmcView d = db.TmcViews.First(o => o.Id == dictionary.Id); db.TmcViews.Remove(d); db.SaveChanges(); } return(Json(new[] { dictionary }.ToDataSourceResult(request, ModelState))); }
public ActionResult UpdateTmcListFirst([DataSourceRequest] DataSourceRequest request, TmcView dictionary) { Tmc d = db.Tmcs.First(o => o.Id == dictionary.Id); d.Name = dictionary.Name; d.Count = dictionary.Count; //d.CountActual = dictionary.CountActual; //d.CountFact = dictionary.CountFact; // d.OwnerEmployeeValue = dictionary.OwnerEmployeeValue; //d.StateType = dictionary.StateType; d.Rack = dictionary.Rack; d.Safe = dictionary.Safe; //d.MeasureTypeConvertDicId = dictionary.MeasureTypeConvertDicId; //d.MeasureTypeConvertDicValue = dictionary.MeasureTypeConvertDicValue; //d.StateTypeValue = dictionary.StateTypeValue; //d.CountConvert = dictionary.CountConvert; d.Manufacturer = dictionary.Manufacturer; //d.CreatedDate = dictionary.CreatedDate; //d.CreatedEmployeeId = dictionary.CreatedEmployeeId; d.ExpiryDate = dictionary.ExpiryDate; d.ManufactureDate = dictionary.ManufactureDate; d.MeasureTypeDicId = dictionary.MeasureTypeDicId; //d.MeasureTypeDicValue = dictionary.MeasureTypeDicValue; d.OwnerEmployeeId = dictionary.OwnerEmployeeId; d.Number = dictionary.Number; d.TmcTypeDicId = dictionary.TmcTypeDicId; //d.StorageDicValue = dictionary.StorageDicValue; //d.TmcTypeDicValue = dictionary.TmcTypeDicValue; d.StorageDicId = dictionary.StorageDicId; d.Serial = dictionary.Serial; d.PackageDicId = dictionary.PackageDicId; //d.PackageDicValue = dictionary.PackageDicValue; d.Code = dictionary.Code; db.SaveChanges(); dictionary = db.TmcViews.First(o => o.Id == d.Id); return(Json(new[] { dictionary }.ToDataSourceResult(request, ModelState))); }
public ActionResult CreateTmcListFirst([DataSourceRequest] DataSourceRequest request, TmcView dictionary) { Tmc tmc = new Tmc() { Id = Guid.NewGuid(), Name = dictionary.Name, Count = dictionary.Count, //CountActual = dictionary.CountActual, //CountFact = dictionary.CountFact, // OwnerEmployeeValue = dictionary.OwnerEmployeeValue, StateType = 1, Rack = dictionary.Rack, Safe = dictionary.Safe, MeasureTypeConvertDicId = dictionary.MeasureTypeConvertDicId, //MeasureTypeConvertDicValue = dictionary.MeasureTypeConvertDicValue, //StateTypeValue = dictionary.StateTypeValue, CountConvert = dictionary.CountConvert, Manufacturer = dictionary.Manufacturer, CreatedDate = DateTime.Now, //dictionary.CreatedDate, CreatedEmployeeId = UserHelper.GetCurrentEmployee().Id, //dictionary.CreatedEmployeeId, ExpiryDate = dictionary.ExpiryDate, ManufactureDate = dictionary.ManufactureDate, MeasureTypeDicId = dictionary.MeasureTypeDicId, //MeasureTypeDicValue = dictionary.MeasureTypeDicValue, OwnerEmployeeId = dictionary.OwnerEmployeeId, Number = dictionary.Number, TmcTypeDicId = dictionary.TmcTypeDicId, //StorageDicValue = dictionary.StorageDicValue, //TmcTypeDicValue = dictionary.TmcTypeDicValue, StorageDicId = dictionary.StorageDicId, Serial = dictionary.Serial, PackageDicId = dictionary.PackageDicId, //PackageDicValue = dictionary.PackageDicValue, Code = dictionary.Code, }; db.Tmcs.Add(tmc); db.SaveChanges(); dictionary = db.TmcViews.First(o => o.Id == tmc.Id); return(Json(new[] { dictionary }.ToDataSourceResult(request, ModelState))); }