コード例 #1
0
        public ActionResult AddClient(ClientView newClient)
        {
            bool anyUser = _repository.GetClients().Any(p => string.Compare(p.Email, newClient.Email) == 0);
            if (anyUser)
            {
                ModelState.AddModelError("Email", "Пользователь с таким email уже зарегистрирован");
                
            }

            if (ModelState.IsValid)
            {
                var currentClient = (Client)_mapper.Map(newClient, typeof(ClientView), typeof(Client));
                this.SaveClient(currentClient);
                return RedirectToAction("Index", "Success");
            }
            return View(newClient);

        }
コード例 #2
0
 public ActionResult AddClient()
 {
     ClientView newClient = new ClientView();
     return View(newClient);
 }