public void Add(CourtConfiguration courtConfiguration) { var courtConfigurationEntity = new CourtConfigurationEntity { CourtId = courtConfiguration.Court.Id, StartHour = courtConfiguration.StartHour, EndHour = courtConfiguration.EndHour, Days = CourtConfigurationLogic.GetDays(courtConfiguration.Days), Price = courtConfiguration.Price, Order = courtConfiguration.Order, StartDate = courtConfiguration.StartDate, EndDate = courtConfiguration.EndDate, }; _context.CourtConfigurations.AddObject(courtConfigurationEntity); _context.SaveChanges(); courtConfiguration.Id = courtConfigurationEntity.Id; }
public void Update(CourtConfiguration courtConfiguration) { var courtConfigurationEntity = _context.CourtConfigurations.First(cc => cc.Id == courtConfiguration.Id); courtConfigurationEntity = new CourtConfigurationEntity { Id = courtConfiguration.Id, CourtId = courtConfiguration.Court.Id, StartHour = courtConfiguration.StartHour, EndHour = courtConfiguration.EndHour, Days = CourtConfigurationLogic.GetDays(courtConfiguration.Days), Price = courtConfiguration.Price, Order = courtConfiguration.Order, StartDate = courtConfiguration.StartDate, EndDate = courtConfiguration.EndDate, }; _context.SaveChanges(); }
private void Delete(CourtConfiguration courtConfiguration) { _context.CourtConfigurations.DeleteObject(new CourtConfigurationEntity { Id = courtConfiguration.Id }); _context.SaveChanges(); }