public IActionResult AddNumber(AddNuwNumberViewModel model) { if (ModelState.IsValid) { bool IsDuplicate = phoneService.IsPhoneNumberIsDuplicate(model.Number); if (IsDuplicate) { ModelState.AddModelError("Number", "شماره تلفن برای مخاطب دیگری ثبت شده است"); } else { Phone phone = new Phone() { PhoneNumber = model.Number, PhoneType = model.PhoneType }; bool IsAddSecces = peopleService.AddNewNumberForPerson(phone, model.PersonId); if (IsAddSecces) { return(RedirectToAction("Detail", new { id = model.PersonId })); } else { ModelState.AddModelError("All", "We Cant Do this Operation ..."); } } } return(View()); }