public ServiceResult <IList <Product> > GetAll() { try { IMediator service = _container.GetInstance <IMediator>(); var query = new ProductGetAllQuery(); return(new ServiceResult <IList <Product> >(service.Proccess(query), message: ClientErrorMessage.Success(), state: ServiceResultStates.SUCCESS)); } catch (ExceptionLog ex) { LoggerService.Logger.Log(_container, ex); return(new ServiceResult <IList <Product> >(result: null, message: ClientErrorMessage.Error(), state: ServiceResultStates.ERROR)); } }
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 <string> Delete(int Id) { try { IMediator service = _container.GetInstance <IMediator>(); var query = new ProductDeleteQuery { Id = Id }; return(new ServiceResult <string>(service.Proccess(query).ToString(), message: ClientErrorMessage.Success(), state: ServiceResultStates.SUCCESS)); } catch (ExceptionLog ex) { LoggerService.Logger.Log(_container, ex); return(new ServiceResult <string>(result: null, message: ClientErrorMessage.Error(), state: ServiceResultStates.ERROR)); } }
public ServiceResult <CommonUserType> Retrieve(int Id) { try { IMediator service = _container.GetInstance <IMediator>(); var query = new CommonUserTypeRetrieveQuery { Id = Id }; return(new ServiceResult <CommonUserType>(service.Proccess(query), message: ClientErrorMessage.Success(), state: ServiceResultStates.SUCCESS)); } catch (ExceptionLog ex) { LoggerService.Logger.Log(_container, ex); return(new ServiceResult <CommonUserType>(result: null, message: ClientErrorMessage.Error(), state: ServiceResultStates.ERROR)); } }
public ServiceResult <CommonUserType> Edit(CommonUserType obj) { try { IMediator service = _container.GetInstance <IMediator>(); IUserContext currentUser = _container.GetInstance <IUserContext>(); var query = new CommonUserTypeEditQuery(); query.CommonUserType = obj; return(new ServiceResult <CommonUserType>(service.Proccess(query), message: ClientErrorMessage.Success(), state: ServiceResultStates.SUCCESS)); } catch (ExceptionLog ex) { LoggerService.Logger.Log(_container, ex); return(new ServiceResult <CommonUserType>(result: null, message: ClientErrorMessage.Error(), state: ServiceResultStates.ERROR)); } }
public ServiceResult <string> ChangePassword(int Id, string Password) { try { IMediator service = _container.GetInstance <IMediator>(); var query = new ChangePasswordQuery { Id = Id, Password = Password }; return(new ServiceResult <string>(service.Proccess(query).ToString(), message: ClientErrorMessage.Success(), state: ServiceResultStates.SUCCESS)); } catch (ExceptionLog ex) { LoggerService.Logger.Log(_container, ex); return(new ServiceResult <string>(result: "false", message: ClientErrorMessage.Error(), state: ServiceResultStates.ERROR)); } }
public ServiceResult <LogLogin> Add(LogLogin obj) { try { IMediator service = _container.GetInstance <IMediator>(); IUserContext currentUser = _container.GetInstance <IUserContext>(); obj.IsDeleted = false; var query = new LogLoginAddQuery(); query.LogLogin = obj; return(new ServiceResult <LogLogin>(service.Proccess(query), message: ClientErrorMessage.Success(), state: ServiceResultStates.SUCCESS)); } catch (ExceptionLog ex) { LoggerService.Logger.Log(_container, ex); return(new ServiceResult <LogLogin>(result: null, message: ClientErrorMessage.Error(), state: ServiceResultStates.ERROR)); } }
public ServiceResult <Product> Edit(Product obj) { try { IMediator service = _container.GetInstance <IMediator>(); IUserContext currentUser = _container.GetInstance <IUserContext>(); var query = new ProductEditQuery(); obj.UpdatedDate = DateTime.Now; obj.UpdatedUserId = currentUser.CurrentUserIdentity.UserID; obj.UpdatedIpAddress = currentUser.CurrentUserIdentity.IpAddress; query.Product = obj; return(new ServiceResult <Product>(service.Proccess(query), message: ClientErrorMessage.Success(), state: ServiceResultStates.SUCCESS)); } catch (ExceptionLog ex) { LoggerService.Logger.Log(_container, ex); return(new ServiceResult <Product>(result: null, message: ClientErrorMessage.Error(), state: ServiceResultStates.ERROR)); } }
public ServiceResult <SampleTable> Add(SampleTable obj) { try { IMediator service = _container.GetInstance <IMediator>(); IUserContext currentUser = _container.GetInstance <IUserContext>(); 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; obj.IsDeleted = false; var query = new SampleTableAddQuery(); query.SampleTable = obj; return(new ServiceResult <SampleTable>(service.Proccess(query), message: ClientErrorMessage.Success(), state: ServiceResultStates.SUCCESS)); } catch (ExceptionLog ex) { LoggerService.Logger.Log(_container, ex); return(new ServiceResult <SampleTable>(result: null, message: ClientErrorMessage.Error(), state: ServiceResultStates.ERROR)); } }