public async Task <HttpResponseMessage> GetAdminModuleList(int BatchID) { try { ModuleDAL dal = new ModuleDAL(); List <ModuleInfo> data = await dal.GetAdminModuleList(BatchID); if (data != null) { return(Request.CreateResponse <List <ModuleInfo> >(HttpStatusCode.OK, data)); } else { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, Constants.ErrorNotFound)); } } catch (DbEntityValidationException ex) { var controllerName = ControllerContext.RouteData.Values["controller"].ToString(); var actionName = ControllerContext.RouteData.Values["action"].ToString(); Logger log = new Logger(); log.ErrorLog(ex, controllerName, actionName); return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, Constants.ErrorSysError)); } }