public ActionResult Edit(int modelId)
        {
            ModelVM model = _repo.ConvertModelToVM(_repo.GetModelById(modelId));

            model.SetMakeItems(_repo.GetMakeList());
            return(View(model));
        }
 public ActionResult Edit(ModelVM model)
 {
     if (!String.IsNullOrEmpty(model.Description) && model.MakeId > 0)
     {
         model.EditUserId = CurrentUser.User.Id;
         model.EditDate   = DateTime.Now;
         model            = _repo.UpdateModel(model);
         if (model.Result.Success)
         {
             return(RedirectToAction("List"));
         }
     }
     else if (String.IsNullOrEmpty(model.Description))
     {
         model.Result              = _repo.ReturnSuccess();
         model.Result.Success      = false;
         model.Result.ErrorMessage = "Description is required";
     }
     else if (model.MakeId <= 0)
     {
         model.Result              = _repo.ReturnSuccess();
         model.Result.Success      = false;
         model.Result.ErrorMessage = "Please choose make";
     }
     model.Result.Success = false;
     model.SetMakeItems(_repo.GetMakeList());
     return(View(model));
 }
        public ActionResult Add()
        {
            ModelVM model = _repo.ConvertModelToVM(new Model());

            model.SetMakeItems(_repo.GetMakeList());
            return(View(model));
        }