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); } }
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)); } }