public bool Ekle(Subject c) { Subject sc = new Subject(); sc.CreatedDate = c.CreatedDate; sc.SectionID = c.SectionID; sc.Name = c.Name; sc.IsActive = c.IsActive; db.Subjects.Add(sc); db.SaveChanges(); return(true); }
public bool Ekle(Section c) { Section section = new Section(); section.Classrooms = c.Classrooms; section.CreatedDate = c.CreatedDate; section.IsActive = c.IsActive; section.Name = c.Name; //section.UserID = c.UserID; db.Sections.Add(section); db.SaveChanges(); return(true); }
public bool Ekle(Classroom c) { Classroom cs = new Classroom(); cs.ClosedDate = c.ClosedDate; cs.CreatedDate = c.CreatedDate; cs.IsActive = c.IsActive; cs.SectionID = cs.SectionID; cs.Name = cs.Name; cs.TrainerID = c.TrainerID; cs.Name = c.Name; cs.SectionID = c.SectionID; db.Classrooms.Add(cs); db.SaveChanges(); return(true); }
public bool Ekle(Presentation c) { Presentation cs = new Presentation(); cs.CreatedDate = c.CreatedDate; cs.IsActive = c.IsActive; cs.FileUrl = c.FileUrl; cs.Id = c.Id; cs.TrainerID = c.TrainerID; cs.SubjectID = c.SubjectID; cs.SectionID = c.SectionID; cs.TrainerID = c.TrainerID; cs.ClassroomID = c.ClassroomID; cs.FileName = c.FileName; cs.TrainerID = c.TrainerID; db.Presentations.Add(cs); db.SaveChanges(); return(true); }
public bool Ekle(Trainer c) { Trainer trainer = new Trainer(); trainer.FirstName = c.FirstName; trainer.LastName = c.LastName; trainer.Password = c.Password; trainer.SectionID = c.SectionID; trainer.EMail = c.EMail; trainer.CreatedDate = c.CreatedDate; trainer.IsActive = c.IsActive; trainer.IsSuperAdmin = c.IsSuperAdmin; //trainer.UserID = c.UserID; trainer.Username = c.Username; trainer.FullName = c.FullName; trainer.Classrooms = c.Classrooms; db.Trainers.Add(trainer); db.SaveChanges(); return(true); }
public bool Ekle(Student student) { //Classroom classroom; //foreach (var cls in student.Classrooms) //{ // classroom = new Classroom(); // classroom.Id = cls.Id; // classroom.Name = cls.Name; // classroom.SectionID = cls.SectionID; // classroom.TrainerID = cls.TrainerID; // classroom.CreatedDate = cls.CreatedDate; // classroom.ClosedDate = cls.ClosedDate; // classroom.IsActive = cls.IsActive; // //clNew = db.Classrooms.FirstOrDefault(clt => clt.Id == cls.Id); // this.student.Classrooms.Add(classroom); //} Student stu = new Student(); //Classroom cls = new Classroom(); //cls = c.Classrooms.FirstOrDefault(); stu.CreatedDate = DateTime.Now; stu.IsActive = student.IsActive; stu.LastName = student.LastName; stu.FirstName = student.FirstName; stu.Email = student.Email; stu.Password = student.Password; stu.UserName = student.UserName; stu.SectionID = student.SectionID; foreach (var item in student.Classrooms) { stu.Classrooms.Add(item); } //stu.Classrooms.Add(cr); //db.Set<Student>().Attach(stu); //db.Entry(stu).State = System.Data.Entity.EntityState.Added; db.Students.Add(student); db.SaveChanges(); return(true); }