Exemplo n.º 1
0
 public ActionResult <Response> AddCategory(Category category)
 {
     try {
         return(new Response()
         {
             Data = _dataService.AddCategory(category),
             ResponseCode = HttpStatusCode.Created,
             Status = true,
             Message = "Created successfully"
         });
     }
     catch (Exception e) {
         return(new Response
         {
             Status = false,
             Message = "Something went wrong from our part, and we are currently working on it.",
             ResponseCode = HttpStatusCode.OK
         });
     }
 }
 public IActionResult CreateNewCategory(CategoriesViewModel vm)
 {
     repo.AddCategory(vm);
     return(RedirectToAction("Index", "Categories"));
 }