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); }
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"); }
public Homework Update(Homework itemToUpdate) { _context.SaveChanges(); return itemToUpdate; }
public Homework Create(Homework itemToCreate) { Homework homework = _context.Homeworks.Add(itemToCreate); _context.SaveChanges(); return homework; }