public ActionResult Add(BusinessPartnerBindingModel model) { //check if model is valid, if not retrn to Index and dispay error message if (!this.ModelState.IsValid) { TempData["class"] = "alert-danger"; TempData["Response-bad"] = "Unable to add new Business Partner "; return(RedirectToAction("Index")); } //check if entity with current name exists if (_bussinessPartner.All().Any(i => i.Name == model.Name)) { TempData["class"] = "alert-danger"; TempData["Response"] = "Bad Request! Unvalid Business Partner should be unique!"; return(RedirectToAction("Index")); } //project to db model and create it var partner = new BusinessPartner() { Email = model.Email, Name = model.Name, PhoneNumber = model.PhoneNumber, }; _bussinessPartner.Add(partner); return(RedirectToRoute("BusinessPartner")); }