Example #1
0
 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));
     }
 }
Example #2
0
 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));
     }
 }
Example #3
0
 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));
     }
 }
Example #4
0
 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));
     }
 }
Example #5
0
 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));
     }
 }
Example #6
0
 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));
     }
 }
Example #7
0
 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));
     }
 }
Example #8
0
 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));
     }
 }
Example #9
0
 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));
     }
 }