public IActionResult Create(AddressBook model) { if (model.DateOfBirth < DateTime.Now.Date) { var address = addressBookService.GetAddresses(); bool addressExist = address.Any(x => x.Email == model.Email); if (addressExist) { return(BadRequest("Address already exist.")); } var add = addressBookService.CreateAddress(model); return(Created($"addressBook/{add.AddressBookId}", add)); } else { return(BadRequest("Date must be past date")); } }