Ejemplo n.º 1
0
        public IHttpActionResult PutOfferAcademic(int id, OfferAcademic offerAcademic)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != offerAcademic.OfferAcademicID)
            {
                return BadRequest();
            }

            db.Entry(offerAcademic).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!OfferAcademicExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
Ejemplo n.º 2
0
        public IHttpActionResult PostOfferAcademic(OfferAcademic offerAcademic)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.OffersAcademics.Add(offerAcademic);
            db.SaveChanges();

            return CreatedAtRoute("DefaultApi", new { id = offerAcademic.OfferAcademicID }, offerAcademic);
        }
Ejemplo n.º 3
0
 public HttpResponseMessage ImportInfo([FromBody()]string[] importContent)
 {
     string type = importContent[0];
     int lines = int.Parse(importContent[1]);
     int info = 2;
     if (type.Equals("Estudiantes"))
     {
         StudentsController sc = new StudentsController();
         for (int i = 0; i < lines; i++)
         {
             Student student = new Student(importContent[info], importContent[info+1], importContent[info+2], importContent[info+3], importContent[info+4], importContent[info+5]);
             IHttpActionResult ac = sc.PostStudent(student);
             info += 6;
         }
         return Request.CreateResponse(HttpStatusCode.OK);
     }
     if (type.Equals("Cursos"))
     {
         CoursesController cc = new CoursesController();
         for (int i = 0; i < lines; i++)
         {
             Course course = new Course(importContent[info]);
             IHttpActionResult ac = cc.PostCourse(course);
             info += 1;
         }
         return Request.CreateResponse(HttpStatusCode.OK);
     }
     if (type.Equals("Profesores"))
     {
         ProfessorsController sd = new ProfessorsController();
         for (int i = 0; i < lines; i++)
         {
             Professor professor = new Professor(importContent[info], importContent[info + 1], importContent[info + 2], importContent[info + 3]);
             IHttpActionResult ac = sd.PostProfessor(professor);
             info += 4;
         }
         return Request.CreateResponse(HttpStatusCode.OK);
     }
     if (type.Equals("Oferta académica"))
     {
         OfferAcademicsController sd = new OfferAcademicsController();
         for (int i = 0; i < lines; i++)
         {
             OfferAcademic offer = new OfferAcademic(importContent[info], importContent[info + 1], importContent[info + 2], importContent[info + 3], importContent[info + 4]);
             IHttpActionResult ac = sd.PostOfferAcademic(offer);
             info += 5;
         }
         return Request.CreateResponse(HttpStatusCode.OK);
     }
     return Request.CreateResponse(HttpStatusCode.NotFound);
 }
Ejemplo n.º 4
0
 public void SendEvaluation(List<Student> students, Evaluation evaluation, OfferAcademic offer)
 {
     Mailer mailer = Mailer.Instance;
     string subject = offer.courseCareerID + " " + offer.days + " " + offer.group + " " + offer.professor.name + " " + offer.professor.firstApe;
     string body = "Favor complete la evaluacion academica ingresando en el siguiente enlace"+Environment.NewLine;
     string bodyLink=string.Empty;
     string linkData = string.Empty;
     foreach (var student in students)
     {
         linkData = Cipher.Instance().Encrypt(evaluation.EvaluationID+":"+student.StudentID+":"+offer.OfferAcademicID+":"+DateTime.Now.ToString("d"));
         bodyLink = body + HttpUtility.UrlEncode("http://localhost:2020/Views/responderEvaluacion?d=" + linkData);
         mailer.SendMail(subject,body+bodyLink,student.firstEmail);
     }
 }