Exemplo n.º 1
0
        public ActionResult Approve(Guid id)
        {
            var rr = new ResourcesRepository();

            var request = rr.GetRequestById(id);

            var highschool = rr.GetHighSchoolByName(request.ScoalaDeProveninenta);

            var teacher = new Teacher(request.Parola, request.Nume, request.Prenume,
                                      request.Mail, highschool);

            using (var context = new EducatieIncluzivaDBContext())
            {
                var entry = context.RegistrationRequests.Find(id);
                context.RegistrationRequests.Remove(entry);
                context.Teachers.Add(teacher);
                context.SaveChanges();
            }
            return(RedirectToAction("CereriInregistrare"));
        }