示例#1
0
            public async Task <Response> Handle(Role_Inst_cmd request, CancellationToken cancellationToken)
            {
                Response response = new Response();

                try
                {
                    TblRolemaster obj = (_mapper.Map <TblRolemaster>(request));
                    obj.CreatedOn = System.DateTime.Now;
                    int result = await _roles.SaveAsync(obj, true, "roles");

                    if (result > 0)
                    {
                        Parallel.Invoke(() => _notificationMsg.SaveMailNotification("*****@*****.**", "*****@*****.**", "Role Created Succesfully " + request.RoleNmae, "Role Created Succesfully " + request.RoleNmae));
                    }

                    response.ResponseObject = result;
                }
                catch (Exception ex)
                {
                    response.ResponseStatus = false;
                    response.ResponseObject = ex.Message + " ~ " + ex.InnerException;
                    response.StatusCode     = HttpStatusCode.BadRequest;
                }
                return(response);
            }
示例#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(User_Upd_cmd request, CancellationToken cancellationToken)
            {
                Response response = new Response();

                try
                {
                    TblUsermaster obj    = (_mapper.Map <TblUsermaster>(request));
                    TblUsermaster entity = await _user.GetDetails(obj.UserId);

                    if (entity != null)
                    {
                        obj.ModifiedOn = System.DateTime.Now;
                        int result = await _user.UpdateAsync(obj);

                        if (result > 0)
                        {
                            Parallel.Invoke(() => _notificationMsg.SaveMailNotification("*****@*****.**", "*****@*****.**", "User Updated Succesfully " + request.EmailId, "User Updated Succesfully " + request.EmailId));
                        }

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