Example #1
0
 public void Install()
 {
     var hourly = new Periode {
         Id = 1,
         Name = PeriodeType.Hourly
     };
     var daily = new Periode
     {
         Id = 1,
         Name = PeriodeType.Daily
     };
     var weekly = new Periode
     {
         Id = 1,
         Name = PeriodeType.Weekly
     };
     var monthly = new Periode
     {
         Id = 1,
         Name = PeriodeType.Monthly
     };
     var yearly = new Periode
     {
         Id = 1,
         Name = PeriodeType.Yearly
     };
     _dataContext.Periodes.AddOrUpdate(hourly);
     _dataContext.Periodes.AddOrUpdate(daily);
     _dataContext.Periodes.AddOrUpdate(weekly);
     _dataContext.Periodes.AddOrUpdate(monthly);
     _dataContext.Periodes.AddOrUpdate(yearly);
 }
Example #2
0
 public DeletePeriodeResponse Delete(int id)
 {
     var response = new DeletePeriodeResponse();
     try
     {
         var periode = new Periode { Id = id };
         DataContext.Periodes.Attach(periode);
         DataContext.Entry(periode).State = EntityState.Deleted;
         DataContext.SaveChanges();
         response.IsSuccess = true;
         response.Message = "Periode item has been Deleted successfully";
     }
     catch (DbUpdateException dbUpdateException)
     {
         response.IsSuccess = false;
         response.Message = dbUpdateException.Message;
     }
     return response;
 }