Esempio n. 1
0
        public IHttpActionResult UpdatePermission(int id, Permission permission)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                PermissionServices.UpdatePermissionById(id, permission);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PermissionExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 2
0
 public IHttpActionResult AddPermission(Permission permission)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     PermissionServices.AddPermission(permission);
     return(Ok(permission));
 }
Esempio n. 3
0
        public IHttpActionResult DeletePermissionById(int id)
        {
            Permission permission = PermissionServices.DeletePermission(id);

            if (permission == null)
            {
                return(NotFound());
            }
            return(Ok(permission));
        }