Exemple #1
0
 public ActionResult CreateDiscografica(Discografica discografica)
 {
     if (ModelState.IsValid)
     {
         var context = new DiscosEntities();
         context.Discograficas.Add(discografica);
         context.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View());
 }
Exemple #2
0
 public ActionResult Create(Discografica model)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(BadRequest(ModelState));
         }
         repo.Add(model);
         repo.Save();
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }
Exemple #3
0
 public ActionResult Edit(Discografica model)
 {
     try
     {
         // TODO: Add update logic here
         if (!ModelState.IsValid)
         {
             return(BadRequest(ModelState));
         }
         repo.Update(model);
         repo.Save();
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }