public ActionResult Create([Bind(Include = "Title")] ProposalDraft draft) { if (ModelState.IsValid) { _proposalService.Create(draft); return(RedirectToAction("Index")); } return(View(draft)); }
public async Task <IActionResult> Add([FromBody] CreateProposalModel model) { if (ModelState.IsValid) { if (!await ProposalService.Exists(model.Description)) { // This should be something var isOk = await ProposalService.Create(model); return(Ok(isOk)); } ModelState.AddModelError("Status", "Er bestaat al een proposal met deze naam."); } return(BadRequest(ModelState)); }