public User Edit(User obj) { IMediator service = _container.GetInstance<IMediator>(); var query = new UserEditQuery(); query.User = obj; return service.Proccess(query); }
public ServiceResult<User> Edit(User obj) { try { IMediator service = _container.GetInstance<IMediator>(); var query = new UserEditQuery(); query.User = obj; return new ServiceResult<User>(service.Proccess(query), message: ClientErrorMessage.Success(), state: ServiceResultStates.SUCCESS); } catch (ExceptionLog ex) { LoggerService.Logger.Log(_container, ex); return new ServiceResult<User>(result: null, message: ClientErrorMessage.Error(), state: ServiceResultStates.ERROR); } }
public ServiceResult<User> Add(User obj) { try { IMediator service = _container.GetInstance<IMediator>(); IUserContext currentUser = _container.GetInstance<IUserContext>(); var query = new UserAddQuery(); obj.CreatedDate = DateTime.Now; obj.CreatedUserId = currentUser.CurrentUserIdentity.UserID; obj.CreatedIpAddress = currentUser.CurrentUserIdentity.IpAddress; obj.UpdatedDate = DateTime.Now; obj.UpdatedUserId = currentUser.CurrentUserIdentity.UserID; obj.UpdatedIpAddress = currentUser.CurrentUserIdentity.IpAddress; query.User = obj; return new ServiceResult<User>(service.Proccess(query), message: ClientErrorMessage.Success(), state: ServiceResultStates.SUCCESS); } catch (ExceptionLog ex) { LoggerService.Logger.Log(_container, ex); return new ServiceResult<User>(result: null, message: ClientErrorMessage.Error(), state: ServiceResultStates.ERROR); } }