Exemplo n.º 1
0
 public IActionResult AddGuarantor(GuarantorViewModel guarantorModel)
 {
     if (ModelState.IsValid)
     {
         Guarantor newGuarantor = new Guarantor
         {
             Name         = guarantorModel.Name,
             Address      = guarantorModel.Address,
             Number       = guarantorModel.Number,
             Gender       = guarantorModel.Gender,
             Relationship = guarantorModel.Relationship,
             Occupation   = guarantorModel.Occupation,
             Email        = guarantorModel.Email,
             Nationality  = guarantorModel.Nationality
         };
         var model = _guarantorRepository.AddGuarantor(newGuarantor);
         StudentGuarantor studentGuarantor = new StudentGuarantor
         {
             StudentId   = guarantorModel.StudentId,
             GuarantorId = model.Id
         };
         _studentGuarantor.AddStdGtr(studentGuarantor);
         return(RedirectToAction("studentinfo", "home", new { id = guarantorModel.StudentId }));
     }
     return(View(guarantorModel));
 }
Exemplo n.º 2
0
        public IActionResult Guarantor(int id)
        {
            GuarantorViewModel viewmodel = new GuarantorViewModel()
            {
                student = _er.GetStudent(id)
            };

            return(View(viewmodel));
        }
Exemplo n.º 3
0
        public ViewResult AddGuarantor(Guid?Id)
        {
            GuarantorViewModel guarantor = new GuarantorViewModel();

            if (Id != null)
            {
                guarantor.StudentId = Id.Value;
            }
            ;
            return(View(guarantor));
        }
Exemplo n.º 4
0
        public IActionResult Guarantor(GuarantorViewModel model)
        {
            Guarantor sd = new Guarantor
            {
                Name      = model.guarantor.Name,
                StudentId = model.student.Id,
                Email     = model.guarantor.Email,
                Phone     = model.guarantor.Phone,
                Address   = model.guarantor.Address,
            };


            var add = _er.AddGuarantor(sd);

            ViewBag.Message = "Data Inserted Successful";

            return(RedirectToAction("Index"));
        }