Exemple #1
0
 public IActionResult EditPresent(EditViewModel model)
 {
     if (model.PresentId != 0)
     {
         _giftService.RemoveGift(model.PresentId);
     }
     else
     {
         try
         {
             _giftService.AddGift(model.Name, model.Description, model.Price,
                                  model.Image, model.Link, model.ProviderId);
         }
         catch (Exception)
         {
             ViewData["error"] = "Gaven kunne ikke tilføjes";
         }
     }
     PrepPresView(model);
     return(View(model));
 }