Beispiel #1
0
        public int Create(Category newCategory)
        {
            var categoryName       = newCategory.Name.ToLower();
            var categoryNameExists = db.Categories.Where(c => c.Name.ToLower() == categoryName).Any();

            if (categoryNameExists)
            {
                return(-2);
            }
            db.Categories.Add(newCategory);
            return(db.SaveChanges());
        }
        public Trainee Create(Trainee trainee)
        {
            db.Trainees.Add(trainee);
            int saveResult = db.SaveChanges();

            if (saveResult > 0)
            {
                return(trainee);
            }
            return(null);
        }
        public int Create(Trainer trainer)
        {
            var existsTrainer = FindByEmail(trainer.E_mail);

            if (existsTrainer != null)
            {
                return(-2);
            }
            trainer.Ceartion_date = DateTime.Now;
            db.Trainers.Add(trainer);
            return(db.SaveChanges());
        }
Beispiel #4
0
 public int Create(Course course)
 {
     course.Creation_Date = DateTime.Now;
     db.Courses.Add(course);
     return(db.SaveChanges());
 }
Beispiel #5
0
 public int Create(Course_Uints courseUnit)
 {
     db.Course_Uints.Add(courseUnit);
     return(db.SaveChanges());
 }