public ActionResult Register(UserModel inModel) { // 2. valididate the fields have the correct data otherwise (if) send error to user and have // them redo the input // data annotations for validation in MVC // valid state, validation passed if (ModelState.IsValid) { // 3. send the input down to the database and check for duplicate username // 3.a create new bll object UserOperationsBLL _userOperationsBLL = new UserOperationsBLL(base.Connection); // 3.b need to convert UserModel object to User object LibraryCommon.DataEntity.User _user = Mapper.UserModelToUser(inModel); // 3.c pass the user object down to bll layer Result _result = _logic.RegisterUser(_user); inModel.DialogMessage = _result.Message; inModel.DialogMessageType = _result.Type.ToString(); return(View(inModel)); } // validation failed, have the user redo the form else { return(View(inModel)); } }
public UserOperationsController(IUserOperationsService UserOperationsService) { _UserOperationsService = UserOperationsService ?? throw new ArgumentException(nameof(UserOperationsService)); _UserOperationBLL = new UserOperationsBLL(_UserOperationsService); }