コード例 #1
0
        public async Task <IActionResult> EditHold(HoldViewModel model)
        {
            if (ModelState.IsValid)
            {
                var hold = await _converterHelper.ToHoldAsync(model, false);

                _datacontext.Holds.Update(hold);
                await _datacontext.SaveChangesAsync();

                return(RedirectToAction($"HoldList/{model.Status_id}"));
            }

            return(View(model));
        }
コード例 #2
0
 public async Task <Hold> ToHoldAsync(HoldViewModel model, bool IsNew)
 {
     return(new Hold
     {
         Id = IsNew ? 0 : model.Id,
         Actual_Quantity = model.Actual_Quantity,
         First_Charge = model.First_Charge,
         Hold_Number = model.Hold_Number,
         Is_Empty = IsNew ? true : false,
         Is_Full = IsNew ? false : true,
         Last_Charge = model.Last_Charge,
         Max_Quantity = model.Max_Quantity,
         Status = await _dataContext.Statuses.FindAsync(model.Status_id)
     });
 }
コード例 #3
0
        public async Task <IActionResult> AddHold(int?id)
        {
            var status = await _datacontext.Statuses.FindAsync(id);

            if (id == null || status == null)
            {
                return(NotFound());
            }

            var model = new HoldViewModel
            {
                Status_id = status.Id
            };

            return(View(model));
        }