public TMEventStatus CreateTMEvent(TMEventDto obj) { TMEvent obje = ConvertToEntity(obj); TMEventStatus result = IsValid(obje); if (result == TMEventStatus.Success) { obje = _tmeventRepository.Create(obje); obj.Id = obje.Id; } return(result); }
public TMEventStatus UpdateTMEvent(TMEventDto obj) { TMEvent obje = ConvertToEntity(obj); TMEventStatus result = IsValid(obje); // check on busy seats TMEventDto current = GetTMEvent(obj.Id); if (current.TMLayoutId != obj.TMLayoutId && GetTMEventSeatByEvent(obj.Id).Where(s => s.State == SeatState.Busy).ToList().Count > 0) { result = TMEventStatus.BusySeatsExists; } if (result == TMEventStatus.Success) { _tmeventRepository.Update(obje); } return(result); }