// GET api/designation public HttpResponseMessage Get() { var Designation = _Designation.GetAllDesignation(); if (Designation != null) { var DesignationEntities = Designation as List <DesignationEntities> ?? Designation.ToList(); if (DesignationEntities.Any()) { return(Request.CreateResponse(HttpStatusCode.OK, DesignationEntities)); } } return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Designation not found")); }