public async Task <Response> Handle(Right_Inst_cmd request, CancellationToken cancellationToken)
            {
                Response response = new Response();

                try
                {
                    TblRightmaster obj = (_mapper.Map <TblRightmaster>(request));
                    obj.CreatedOn = System.DateTime.Now;

                    int result = await _right.SaveAsync(obj, true, "rights");

                    if (result > 0)
                    {
                        Parallel.Invoke(() => _notificationMsg.SaveMailNotification("*****@*****.**", "*****@*****.**", "Right Created Succesfully " + request.RoleId, "Right Created Succesfully " + request.RoleId));
                    }
                    response.ResponseObject = result;
                }
                catch (Exception ex)
                {
                    response.ResponseStatus = false;
                    response.ResponseObject = ex.Message + " ~ " + ex.InnerException;
                    response.StatusCode     = HttpStatusCode.BadRequest;
                }
                return(response);
            }
Esempio n. 2
0
            public async Task <Response> Handle(Right_Del_cmd request, CancellationToken cancellationToken)
            {
                Response response = new Response();

                try
                {
                    TblRightmaster entity = await _rights.GetDetails(request.Id);

                    if (entity != null)
                    {
                        entity.IsDeleted = true;
                        entity.DeletedOn = System.DateTime.Now;

                        int result = await _rights.UpdateAsync(entity, true, "rights");

                        if (result > 0)
                        {
                            Parallel.Invoke(() => _notificationMsg.SaveMailNotification("*****@*****.**", "*****@*****.**", "Right Delete Succesfully " + entity.RightId, "Right Delete Succesfully " + entity.RightId));
                        }

                        response.ResponseObject = request;
                    }
                }
                catch (Exception ex)
                {
                    response.ResponseStatus = false;
                    response.ResponseObject = ex.Message + " ~ " + ex.InnerException;
                    response.StatusCode     = HttpStatusCode.BadRequest;
                }
                return(response);
            }
            public async Task <Response> Handle(Right_Dtl_cmd request, CancellationToken cancellationToken)
            {
                Response response = new Response();

                try
                {
                    TblRightmaster entity = await _rights.GetDetails(request.Id);

                    if (entity != null)
                    {
                        response.ResponseObject = entity;
                    }
                }
                catch (Exception ex)
                {
                    response.ResponseStatus = false;
                    response.ResponseObject = ex.Message + " ~ " + ex.InnerException;
                    response.StatusCode     = HttpStatusCode.BadRequest;
                }
                return(response);
            }