public async Task <ActionResult> Create(string Name, string Description) { WirlyDbContext db = HttpContext.GetOwinContext().Get <WirlyDbContext>(); var projectWithSameNameExists = db.Projects.Any(p => p.Name == Name); if (projectWithSameNameExists) { ModelState.AddModelError("", "There is already a project with that name"); } else { db.Projects.Add(new Project() { Name = Name, Description = Description }); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View()); }