public ActionResult Edit(SalesRepresentativeViewModel salesRepresentativeViewModel)
        {
            if (ModelState.IsValid)
            {
                _db.UpdateSalesRepresentative(salesRepresentativeViewModel.SalesRepresentative);
            }

            return(RedirectToAction("Index", "SalesRepresentative"));
        }
        public ActionResult SalesRepresentativeForm()
        {
            var workRoutes = _db.GetAllWorkRoutess();

            var viewModel = new SalesRepresentativeViewModel()
            {
                workRoutes = workRoutes
            };

            return(View(viewModel));
        }
        public ActionResult Delete(int?id)
        {
            var salesRepresentative = _db.GetSalesRepresentativeById(id);
            var workRoutes          = _db.GetAllWorkRoutess();

            if (salesRepresentative == null)
            {
                return(HttpNotFound());
            }

            var viewModel = new SalesRepresentativeViewModel()
            {
                SalesRepresentative = salesRepresentative,
                workRoutes          = workRoutes
            };

            return(View(viewModel));
        }
 public ActionResult Create(SalesRepresentativeViewModel viewModel)
 {
     _db.AddSalesRepresentative(viewModel.SalesRepresentative);
     return(RedirectToAction("Index", "SalesRepresentative"));
 }
 public ActionResult Delete(SalesRepresentativeViewModel salesRepresentativeViewModel)
 {
     _db.RemoveSalesRepresentative(salesRepresentativeViewModel.SalesRepresentative.Id);
     return(RedirectToAction("Index", "SalesRepresentative"));
 }