Пример #1
0
        public async Task <int> UpdateShopStatus(Guid statusId, UpdateShopStatusRequest request)
        {
            var existShopStatus = _context.ShopStatuses.FirstOrDefault(item => item.statusId.Equals(statusId));

            if (existShopStatus != null)
            {
                existShopStatus.statusName = request.statusName;
                existShopStatus.updateDate = DateTime.Now;
                existShopStatus.createUser = "******"; //TODO: Get UserName Login
            }
            return(await _context.SaveChangesAsync());
        }
Пример #2
0
        public async Task <IActionResult> UpdateShopStatus(Guid statusId, [FromForm] ShopStatusDetailViewModel model)
        {
            if (ModelState.IsValid)
            {
                var shopStatusService       = serviceLocator.GetService <IShopStatusService>();
                var updateShopStatusRequest = new UpdateShopStatusRequest
                {
                    statusName = model.name
                };
                await shopStatusService.UpdateShopStatus(statusId, updateShopStatusRequest);

                TempData["message"] = $"Trạng thái {model.name} đã được cập nhật";
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View("Views/Shop/ShopStatusEditView.cshtml", model));
            }
        }