Exemplo n.º 1
0
 public Homework UpdateHomeworkFromHomeworkEditModel(Homework displayHomeworkModel, Homework homework)
 {
     homework.Id = displayHomeworkModel.Id;
     homework.Title = displayHomeworkModel.Title;
     homework.Description = displayHomeworkModel.Description;
     homework.DeliverDate = displayHomeworkModel.DeliverDate;
     homework.Points = displayHomeworkModel.Points;
     homework.AcademicYearDetail = displayHomeworkModel.AcademicYearDetail;
     return Update(homework);
 }
Exemplo n.º 2
0
        public ActionResult Create(CreateHomeworkModel modelHomework)
        {
            var myHomework = new Homework
            {
                Title = modelHomework.Title,
                Description = modelHomework.Description,
                DeliverDate = ParseToHonduranDateTime.Parse(modelHomework.DeliverDate),
                Points = modelHomework.Points,
                AcademicYearDetail = _academicYearDetailRepository.FindByCourse(_courseRepository.GetById(modelHomework.Course).Id,GetTeacherId())
            };

            _homeworkRepository.Create(myHomework);
            const string title = "Tarea agregada";
            string content = "La tarea " + myHomework.Title + " ha sido agregado exitosamente.";
            _viewMessageLogic.SetNewMessage(title, content, ViewMessageType.SuccessMessage);
            return RedirectToAction("Index");
        }
Exemplo n.º 3
0
 public Homework Update(Homework itemToUpdate)
 {
     _context.SaveChanges();
     return itemToUpdate;
 }
Exemplo n.º 4
0
 public Homework Create(Homework itemToCreate)
 {
     Homework homework = _context.Homeworks.Add(itemToCreate);
     _context.SaveChanges();
     return homework;
 }