Example #1
0
        public IActionResult Edit(Result <CategoryViewModel> model)
        {
            model.Data.CategoryDO.UpdateUserId = GetLoggedUserId();
            Result <CategoryDO> result = _categoryBL.Update(CacheKey, model.Data.CategoryDO);

            return(Json(result));
        }
        public ActionResult CategoryEdit(CategoryModel Model)
        {
            if (ModelState.IsValid)
            {
                List <string> lstMsg     = new List <string>();
                int           returnCode = _categoryBL.Update(Model, out lstMsg);

                if (!((int)Common.ReturnCode.Succeed == returnCode))
                {
                    if (lstMsg != null)
                    {
                        for (int i = 0; i < lstMsg.Count(); i++)
                        {
                            ModelState.AddModelError(string.Empty, lstMsg[i]);
                        }
                    }
                    ViewBag.Parent = new SelectList(_categoryBL.GetListParent(true), "id", "name");
                    return(View(Model));
                }
                TempData["Success"] = "Updated Successfully!";
                return(RedirectToAction("CategoryView", new { @id = Model.id }));
            }
            ViewBag.Parent = new SelectList(_categoryBL.GetListParent(true), "id", "name");
            return(View(Model));
        }
Example #3
0
 public ActionResult Edit(CategoryModel categoryModel)
 {
     try
     {
         if (ModelState.IsValid)
         {
             Category category = AutoMapper.Mapper.Map <CategoryModel, Category>(categoryModel);
             categoryBL.Update(category);
             return(RedirectToAction("CategoryDetails"));
         }
     }
     catch
     {
         View("Error");
     }
     return(View());
 }
Example #4
0
 public IActionResult Put(string id, [FromBody] CategoryRequest request)
 {
     return(Ok(_categoryBL.Update(id, request)));
 }
        public async Task <IActionResult> Patch([FromRoute] string id, [FromBody] Category viewModel)
        {
            var updated = await _categoryBL.Update(id, viewModel);

            return(Accepted(updated));
        }
Example #6
0
        public IActionResult UpdateCategory([FromBody] CategoryDO category)
        {
            Result <CategoryDO> result = _categoryBL.Update(CacheKey, category);

            return(Json(result));
        }