Beispiel #1
0
        public void UpdateUser(User user)
        {
            var uow = m_unitOfWorkFactory.Create();

            m_userRepository.Update(user);

            uow.Commit();
        }
Beispiel #2
0
        public void CreateUser(User user)
        {
            ValidateUserCreate(user);
            //assign default value
            user.IsActive = true;

            var uow = m_unitOfWorkFactory.Create();

            m_userRepository.Create(user);

            uow.Commit();
        }
Beispiel #3
0
        public ActionResult Create(UserCreateModel userCreateModel)
        {
            User user = new User();

                Mapper.Map(userCreateModel, user);

                UserService.CreateUser(user);

                //Thread.Sleep(5000);

                this.ShowNotification(NotificationType.Success, "User berhasil ditambah", true);
                return RedirectToAction("Index");
            //}
            //return View();
        }
Beispiel #4
0
        private void ValidateUserCreate(User user)
        {
            var errors = new List<ValidationResult>();

            if(!IsLoginAvailable(user.Login))
            {
                errors.Add(new ValidationResult(Resources.UserCreateModel_LoginAlreadyExist, new[] { "Login" }));

                throw ExceptionHandling.HandleBusinessValidation(errors);
            }
        }
Beispiel #5
0
        public ActionResult Delete(UserUpdateModel userCreateUpdateModel)
        {
            //Thread.Sleep(5000);
            var userToDelete = new User();
            Mapper.Map(userCreateUpdateModel, userToDelete);
            UserService.DeleteUser(userToDelete);

            this.ShowNotification(NotificationType.Success, "User berhasil dihapus", true);
            return RedirectToAction("Index");
        }