private static void SendWelcomeMailOperation(IResultObjectModel <UserDto> resultObjectModel) { if (resultObjectModel.IsSuccess) { IUserRegisterMailOperation welcomeMailOperation = IoCManager.Resolve <IUserRegisterMailOperation>(); welcomeMailOperation.Welcome(resultObjectModel.Data); } }
private static void GetUser(int id) { IUserOperationManager userManager = IoCManager.Resolve <IUserOperationManager>(); IResultObjectModel <UserDto> userResult = userManager.Get(id); SetResult("GetUser", userResult); if (userResult.IsSuccess) { Console.WriteLine("Email :" + userResult.Data.Email); } }
private static IResultObjectModel <UserDto> RegisterUser(string email, string password) { IUserOperationManager userManager = IoCManager.Resolve <IUserOperationManager>(); IResultObjectModel <UserDto> result = userManager.Register(new UserRegisterInputModel { Email = email, Password = password }); SetResult("RegisterUser", result); return(result); }
private IResultObjectModel <UserDto> EditUserDtoByInputModel(IUserInputModel inputModel, UserEditInputModel userEditInputModel) { IResultObjectModel <UserDto> getResult = Get(userEditInputModel.Id); if (getResult.IsSuccess) { IUserEditInputBusinessOperation userEditBusinessOperation = IoCManager.Resolve <IUserEditInputBusinessOperation>(); getResult.Data = userEditBusinessOperation.Edit(getResult.Data, inputModel); } getResult.SetResult(); return(getResult); }
private IResultObjectModel <UserDto> UpdateByEditResult(IResultObjectModel <UserDto> resultObjectModel, IResultObjectModel <UserDto> editResult) { if (editResult.IsSuccess) { resultObjectModel = Update(editResult.Data); } else { resultObjectModel.Messages.AddRange(editResult.Messages); } return(resultObjectModel); }
public virtual IResultModel Delete(TKey id) { IResultModel resultModel = new ResultModel(); IResultObjectModel <TModel> getResult = Get(id); if (getResult.IsSuccess) { resultModel = Delete(getResult.Data); } else { resultModel.Messages.AddRange(getResult.Messages); } resultModel.SetResult(); return(resultModel); }
public IResultObjectModel <UserDto> Edit(IUserInputModel inputModel) { IResultObjectModel <UserDto> resultObjectModel = new ResultObjectModel <UserDto>(); try { //UserEditInputModel için özel bir validationOperation'da tercih edilebilir. UserEditInputModel userEditInputModel = (UserEditInputModel)inputModel; IResultObjectModel <UserDto> editResult = EditUserDtoByInputModel(inputModel, userEditInputModel); resultObjectModel = UpdateByEditResult(resultObjectModel, editResult); } catch (System.Exception ex) { resultObjectModel.IsSuccess = false; ExceptionManager exceptionManager = new ExceptionManager(ex); resultObjectModel.Messages.AddRange(exceptionManager.GetMessages()); } resultObjectModel.SetResult(); return(resultObjectModel); }