public void EditTeacher(TeacherDTO teacher) { var toEdit = Mapping.Mapper.Map <Teacher>(teacher); context.Entry(toEdit).State = EntityState.Modified; context.SaveChanges(); }
public void EditStudent(StudentDTO student) { var toEdit = Mapping.Mapper.Map <Student>(student); context.Entry(toEdit).State = EntityState.Modified; context.SaveChanges(); }
public void EditAnswer(AnswerDTO answer) { var toEdit = Mapping.Mapper.Map <Answer>(answer); context.Entry(toEdit).State = EntityState.Modified; context.SaveChanges(); }
public void EditTest(TestDTO test) { var toEdit = context.Tests.Find(test.TestID); toEdit.Name = test.Name; toEdit.TimeFrom = test.TimeFrom; toEdit.TimeTo = test.TimeTo; context.Entry(toEdit).State = EntityState.Modified; context.SaveChanges(); }
public void EditStudentGroup(StudentGroupDTO studentGroup) { //var toEdit = Mapping.Mapper.Map<StudentGroup>(studentGroup); var toEdit = context.StudentGroups.Find(studentGroup.StudentGroupID); toEdit.Name = studentGroup.Name; toEdit.RegistrateCode = studentGroup.RegistrateCode; context.Entry(toEdit).State = EntityState.Modified; context.SaveChanges(); }
public void EditTopic(TopicDTO topic, int parentID) { var toEdit = context.Topics.Find(topic.TopicID); toEdit.Name = topic.Name; Topic parent = context.Topics.Find(parentID); parent.InferiorTopics.Add(toEdit); toEdit.SuperiorTopic = parent; context.Entry(toEdit).State = EntityState.Modified; context.SaveChanges(); }
public void EditQuestion(QuestionDTO question, int topicID) { var toEdit = context.Questions.Find(question.QuestionID); toEdit.Explanation = question.Explanation; toEdit.Description = question.Description; toEdit.Points = question.Points; toEdit.Type = question.Type; toEdit.Topic = context.Topics.Find(topicID); context.Entry(toEdit).State = EntityState.Modified; context.SaveChanges(); }