Exemple #1
0
        public async Task <IActionResult> Update(HangPhong model)
        {
            var data = await _HangPhongManager.Find_By_Id(model.Id);

            if (data != null)
            {
                await _HangPhongManager.Update(model);

                ViewData["successMsg"] = "Sửa thành công";
            }

            return(Redirect("/hang-phong/danh-sach-hang-phong"));
        }
Exemple #2
0
        public async Task Update(HangPhong inputModel)
        {
            try
            {
                await _unitOfWork.HangPhongRepository.Update(inputModel);

                await _unitOfWork.SaveChange();
            }
            catch (Exception ex)
            {
                await _unitOfWork.Rollback();

                throw ex;
            }
        }
Exemple #3
0
        public async Task <HangPhong> Create(HangPhong inputModel)
        {
            try
            {
                var result = await _unitOfWork.HangPhongRepository.Add(inputModel);

                await _unitOfWork.SaveChange();

                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #4
0
        public async Task <IActionResult> Delete(HangPhong model)
        {
            try
            {
                var item = await _HangPhongManager.Find_By_Id(model.Id);

                item.TrangThai = false;
                await _HangPhongManager.Update(item);

                return(Json(new
                {
                    data = true
                }));
            }
            catch (Exception ex)
            {
                return(Json(new
                {
                    data = false
                }));
            }
        }
Exemple #5
0
        public async Task <IActionResult> Create(HangPhong inputModel)
        {
            await _HangPhongManager.Create(inputModel);

            return(View());
        }