コード例 #1
0
        public ActionResult Update(Design model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var flag = _designService.CheckContain(model.Id, model.Name);
                    if (flag)
                    {
                        AlertWarning(InfoString.SetContainString("Tên"));
                        ViewData["ParentCategories"] = _categoryService.GetParents(1);//parent type production
                        return(View(model));
                    }

                    model.UpdateBy   = "hadacduong";
                    model.UpdateDate = DateTime.Now;
                    _designService.Update(model);
                    _designService.CommitChanges();
                    AlertSuccess(InfoString.UPDATE_SUCCESSFULL);
                }
                catch (Exception ex)
                {
                    Log(ex);
                    AlertError(InfoString.ERROR_SYSTEM);
                }

                return(RedirectToAction("Index", "Design", new { ParentCategoryId = model.ParentCategoryId }));
            }
            AlertWarning(InfoString.INVALID_INFO);
            ViewData["ParentCategories"] = _categoryService.GetParents(1);//parent type production
            return(View(model));
        }
コード例 #2
0
ファイル: DesignRepo.cs プロジェクト: K8rvin/NailNotes
        public DesignBl Update(DesignBl item)
        {
            var dto = _service.Update(item?.ToDto());

            return(dto != null ? new DesignBl(dto) : null);
        }