// GET: VisitOnSite/Edit/5
        public ActionResult Edit(int id)
        {
            VisitOnSite          visitOnSite = db.VisitOnSites.Find(id);
            VisitOnSiteViewModel model       = Mapper.Map <VisitOnSite, VisitOnSiteViewModel>(visitOnSite);

            return(View(model));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            VisitOnSite visitOnSite = db.VisitOnSites.Find(id);

            db.VisitOnSites.Remove(visitOnSite);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Create(VisitOnSiteViewModel model)
 {
     if (ModelState.IsValid)
     {
         VisitOnSite visitOnSite = Mapper.Map <VisitOnSiteViewModel, VisitOnSite>(model);
         db.VisitOnSites.Add(visitOnSite);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
 public ActionResult Edit(VisitOnSiteViewModel model)
 {
     if (ModelState.IsValid)
     {
         VisitOnSite visitOnSite = Mapper.Map <VisitOnSiteViewModel, VisitOnSite>(model);
         db.Entry(visitOnSite).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }