public ActionResult Create(StudentViewModel model, AddressBusinessModel addressModel) { try { StudentBusinessModel student = new StudentBusinessModel() { Name = model.Name, BirthDate = model.BirthDate, Height = model.Height, Weight = model.Weight }; _studentManagement.Add(student); AddressBusinessModel address = new AddressBusinessModel() { StudentId = student.Id, Streeet = addressModel.Streeet, City = addressModel.City, County = addressModel.County, StudentName = model.Name }; _addressManagement.Add(address); return RedirectToAction("Index"); } catch(Exception ex) { return View("Error"); } }
public ActionResult Create(AddressViewModel model) { try { var address = new AddressBusinessModel() { StudentId = model.StudentId, Streeet = model.Streeet, City = model.City, County = model.County }; _addressManagement.Add(address); return RedirectToAction("Index"); } catch { return View("Error"); } }