예제 #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"));
        }
예제 #2
0
        public ActionResult Create()
        {
            var nurse = new CreateNurseViewModel();

            return(View(nurse));
        }