public JsonResult Post([FromBody] RecordPostModel recordModel) { // Admin and Client can access if (AuthRepo.IsAuthenticated()) { User currentUser = AppRepo.GetUserById(AuthRepo.CurrentUserId); int status; string msg; AppRepo.AddRecord(currentUser, recordModel, out status, out msg); Response.StatusCode = status; return(Json(new { Msg = msg })); } Response.StatusCode = 401; return(Json(new { Msg = "Unauthorized" })); }