public IActionResult Edit(string id) { var categoryInput = new CategoryInput(); var category = _categoriesViewModel.Service.GetById(id); categoryInput.Set(category); return(View("~/Views/AdminPanel/Categories/Edit.cshtml", categoryInput)); }
public IActionResult Create(CategoryInput category) { var specs = JsonConvert.DeserializeObject <Dictionary <string, string> >(category.specStr); var newCategory = new Category() { Id = category.Id, Name = category.Name, Image = category.Image, Specs = specs.Values.ToList() }; _categoriesViewModel.Service.Create(newCategory); return(RedirectToAction("Index")); }
public IActionResult Edit(CategoryInput category) { var specs = JsonConvert.DeserializeObject <Dictionary <string, string> >(category.specStr); var newCategory = new Category() { Id = category.Id, Name = category.Name, Image = category.Image, Specs = specs.Values.ToList() }; _categoriesViewModel.Service.Update(newCategory); return(View("~/Views/AdminPanel/Categories/Index.cshtml", _categoriesViewModel)); }