Ejemplo n.º 1
0
 public ActionResult Edit(UserViewModel model)
 {
     try
     {
         // TODO: Add insert logic here
         using (repositoryContext context = new repositoryContext())
         {
             user user = Mapper.Map <user>(model);
             GenericRepository <user> users = new GenericRepository <user>(context);
             users.Update(user);
             context.SaveChanges();
         }
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         return(View());
     }
 }
Ejemplo n.º 2
0
 public ActionResult Create(NewsViewModel model)
 {
     try
     {
         // TODO: Add insert logic here
         using (repositoryContext context = new repositoryContext())
         {
             news News = Mapper.Map <news>(model);
             GenericRepository <news> news = new GenericRepository <news>(context);
             news.Insert(News);
             context.SaveChanges();
         }
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         return(View());
     }
 }