public ActionResult <ResponseContext> GetLoaiHSByMaLoaiHS(string DocumentCategoryId) { try { if ((bool)HttpContext.Items["isLoggedInOtherDevice"]) { return(Ok(new ResponseContext { code = (int)Common.ResponseCode.IS_LOGGED_IN_ORTHER_DEVICE, message = Common.Message.IS_LOGGED_IN_ORTHER_DEVICE, data = null })); } var objLoaiHS = new Models.DocumentCategory(); objLoaiHS = _loaiHSServices.GetDocumentCategory(DocumentCategoryId); return(Ok(new ResponseContext { code = (int)Common.ResponseCode.SUCCESS, message = Common.Message.SUCCESS, data = objLoaiHS })); } catch (System.Exception ex) { _logger.LogError(ex, ex.Message); return(StatusCode(StatusCodes.Status500InternalServerError, new ResponseMessage { status = "ERROR", message = ex.Message })); } }
public IActionResult OnGet(int documentCategoryId) { DocumentCategoryObj = new Models.DocumentCategory(); //Edit existing if (documentCategoryId != 0) { DocumentCategoryObj = _unitOfWork.DocumentCategory.GetFirstOrDefault(c => c.Id == documentCategoryId); if (DocumentCategoryObj == null) { //Returns a 404 error page. return(NotFound()); } } return(Page()); }