Пример #1
0
        public ActionResult Create(CreateNurseViewModel nursevm)
        {
            if (!ModelState.IsValid)
            {
                return(View(nursevm));
            }
            var nurse = _mapper.Map <CreateNurseViewModel, User>(nursevm);

            if (!_nurseService.CheckUniqueness(nurse))
            {
                ModelState.AddModelError("", "User with same UserName or Email exist!");
                return(View(nursevm));
            }
            _nurseService.Create(nurse);
            _loggerService.Info($"{User.Identity.Name} added {nurse.FirstName} {nurse.LastName}");
            return(RedirectToAction("Index"));
        }