Ejemplo n.º 1
0
        public bool Delete(int id)
        {
            // TO DO : Code to remove the records from database
            TblTrainingList Trainings = TrainingDB.TblTrainingLists.Find(id);

            TrainingDB.TblTrainingLists.Remove(Trainings);
            TrainingDB.SaveChanges();
            return(true);
        }
Ejemplo n.º 2
0
 public IEnumerable PutTraining(int id, TblTrainingList Training)
 {
     Training.Id = id;
     if (repository.Update(Training))
     {
         return(repository.GetAll());
     }
     else
     {
         return(null);
     }
 }
Ejemplo n.º 3
0
        public TblTrainingList Add(TblTrainingList item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            // TO DO : Code to save record into database
            TrainingDB.TblTrainingLists.Add(item);
            TrainingDB.SaveChanges();
            return(item);
        }
Ejemplo n.º 4
0
        public bool Update(TblTrainingList item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            // TO DO : Code to update record into database
            var Trainings = TrainingDB.TblTrainingLists.Single(a => a.Id == item.Id);

            Trainings.Name     = item.Name;
            Trainings.Category = item.Category;
            Trainings.Price    = item.Price;
            TrainingDB.SaveChanges();

            return(true);
        }
Ejemplo n.º 5
0
 public TblTrainingList PostTraining(TblTrainingList item)
 {
     return(repository.Add(item));
 }