Пример #1
0
        public HttpResponseMessage EditRole(Role role)
        {
            HttpResponseMessage response = null;

            try
            {
                if (role != null)
                {
                    if (RoleRepo.GetRoleById(role.id) != null)
                    {
                        RoleRepo.EditRole(role);
                        response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "ROle Updated successfully!", "ROle Updated successfully!"));
                    }
                    else
                    {
                        response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_702", "Invalid role object", "Invalid role object"));
                    }
                }
                else
                {
                    response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_102", "Invalid Input", "Please check input Json"));
                }
            }
            catch (Exception exception)
            {
                Debug.WriteLine(exception.Message);
                Debug.WriteLine(exception.GetBaseException());
                response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_101", "Application Error", exception.Message));
            }
            return(response);
        }