public ActionResult Edit(int? id)
        {
            ConsultantService consultantService = new ConsultantService();
            ConsultantEditVM model = new ConsultantEditVM();
            Consultant consultant;

            if (!id.HasValue)
            {
                consultant = new Consultant();
            }
            else
            {
                consultant = consultantService.GetById(id.Value);
                if (consultant == null)
                {
                    return RedirectToAction("List");
                }
            }

            model.Id = consultant.Id;
            model.Username = consultant.Username;
            model.Password = consultant.Password;
            model.FirstName = consultant.FirstName;
            model.LastName = consultant.LastName;
            model.Email = consultant.Email;
            model.Rank = consultant.Rank;
            return View(model);
        }
        public ActionResult Edit()
        {
            ConsultantService consultantService = new ConsultantService();
            ConsultantEditVM model = new ConsultantEditVM();
            TryUpdateModel(model);

            Consultant consultant;
            if (model.Id == 0)
            {
                consultant = new Consultant();
            }
            else
            {
                consultant = consultantService.GetById(model.Id);
                if (consultant == null)
                {
                    return RedirectToAction("List");
                }
            }

            if (!ModelState.IsValid)
            {
                return View(model);
            }

            consultant.Id = model.Id;
            consultant.Username = model.Username;
            consultant.Password = model.Password;
            consultant.FirstName = model.FirstName;
            consultant.LastName = model.LastName;
            consultant.Email = model.Email;
            consultant.Rank = model.Rank;

            consultantService.Save(consultant);
            return RedirectToAction("List");
        }