public ActionResult Create(CreateSessionModel model) { var result = examsession.Save(model); if (result.status) { ViewBag.token = result.message; return(View(result.Data)); } else { ViewBag.ErrorMessage = result.message; return(View("Error")); } }
public IActionResult Create([FromBody] CreateSessionModel model) { if (ModelState.IsValid) { var result = examsession.Save(model); if (result.status) { string url = "ValidateToken/" + result.message; //string url = HttpContext.Current.Request.Url.Host + "/api/CreateSessionApi/ValidateToken/" + result.message; return(Ok(url)); } else { return(BadRequest(result.message)); } } else { return(BadRequest(ModelState)); } }