예제 #1
0
        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");
            }
        }
예제 #2
0
 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");
     }
 }