Example #1
0
        public ActionResult UpdateDelivery([DataSourceRequest] DataSourceRequest request, TmcOutView dictionary)
        {
            TmcOut d = db.TmcOuts.First(o => o.Id == dictionary.Id);

            d.StateType       = dictionary.StateType;
            d.Note            = dictionary.Note;
            d.OutTypeDicId    = dictionary.OutTypeDicId;
            d.StorageDicId    = dictionary.StorageDicId;
            d.OwnerEmployeeId = dictionary.OwnerEmployeeId;
            d.Rack            = dictionary.Rack;
            d.Safe            = dictionary.Safe;
            db.SaveChanges();
            return(Json(new[] { dictionary }.ToDataSourceResult(request, ModelState)));
        }
Example #2
0
        public ActionResult DestroyDelivery([DataSourceRequest] DataSourceRequest request, TmcOutView dictionary)
        {
            if (dictionary != null)
            {
                TmcOut d = db.TmcOuts.First(o => o.Id == dictionary.Id);
                db.TmcOuts.Remove(d);
                db.SaveChanges();
            }

            return(Json(new[] { dictionary }.ToDataSourceResult(request, ModelState)));
        }
Example #3
0
        public ActionResult CreateDelivery([DataSourceRequest] DataSourceRequest request, TmcOutView dictionary)
        {
            TmcOut tmc = new TmcOut()
            {
                Id                = Guid.NewGuid(),
                StateType         = dictionary.StateType,
                Note              = dictionary.Note,
                OutTypeDicId      = dictionary.OutTypeDicId,
                CreatedDate       = DateTime.Now,
                CreatedEmployeeId = UserHelper.GetCurrentEmployee().Id,
                StorageDicId      = dictionary.StorageDicId,
                OwnerEmployeeId   = dictionary.OwnerEmployeeId,
                Safe              = dictionary.Safe,
                Rack              = dictionary.Rack,
            };

            db.TmcOuts.Add(tmc);
            db.SaveChanges();
            dictionary.Id = tmc.Id;
            return(Json(new[] { dictionary }.ToDataSourceResult(request, ModelState)));
        }