Beispiel #1
0
 // DELETE api/designation/5
 public bool Delete(int id)
 {
     if (id > 0)
     {
         return(_Designation.DeleteDesignation(id));
     }
     return(false);
 }
Beispiel #2
0
        public async Task <JsonResult> DeleteDesignation(int designationId)
        {
            JsonData <JsonStatus> data = new JsonData <JsonStatus>(new JsonStatus());

            if (true == await _designation.DeleteDesignation(designationId))
            {
                data.Result.Status = true;
            }

            return(Json(data)); // returns.
        }
        public async Task <IActionResult> DeleteDesignation(int designationId)
        {
            #region Authorization code
            var    identity = HttpContext.User.Identity as ClaimsIdentity;
            string id       = "";
            string role     = "";
            if (identity != null)
            {
                IEnumerable <Claim> claims = identity.Claims;
                // or
                id   = identity.Claims.Where(m => m.Type == ClaimTypes.Sid).Select(m => m.Value).FirstOrDefault();
                role = identity.Claims.Where(m => m.Type == ClaimTypes.Role).Select(m => m.Value).FirstOrDefault();
            }
            long userId = Convert.ToInt32(id);
            #endregion
            //calling DesignationDAL busines layer
            CommonResponse response = new CommonResponse();
            response = designation.DeleteDesignation(designationId, userId);

            return(Ok(response));
        }