Ejemplo n.º 1
0
 public IActionResult Upsert(int?id)
 {
     BookBazar.Models.Catagory catagory = new BookBazar.Models.Catagory();
     if (id == null)
     {
         return(View(catagory));
     }
     catagory = _iUnitOfWork.Catagory.Get(id.GetValueOrDefault());
     if (catagory == null)
     {
         return(NotFound());
     }
     return(View(catagory));
 }
Ejemplo n.º 2
0
 public IActionResult Upsert(BookBazar.Models.Catagory catagory)
 {
     if (ModelState.IsValid)
     {
         if (catagory.CatagoryId == 0)
         {
             _iUnitOfWork.Catagory.Add(catagory);
         }
         else
         {
             _iUnitOfWork.Catagory.Update(catagory);
         }
         _iUnitOfWork.Save();
         return(RedirectToAction(nameof(Index)));
     }
     return(View(catagory));
 }