Esempio n. 1
0
 private static void SendWelcomeMailOperation(IResultObjectModel <UserDto> resultObjectModel)
 {
     if (resultObjectModel.IsSuccess)
     {
         IUserRegisterMailOperation welcomeMailOperation = IoCManager.Resolve <IUserRegisterMailOperation>();
         welcomeMailOperation.Welcome(resultObjectModel.Data);
     }
 }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
 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);
 }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
        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);
        }