public static RevenueModel ConvertToRevenueModel(UserEventHistory revenue) { RevenueModel revenueModel = new RevenueModel(); revenueModel.EventId = revenue.Event.Id; revenueModel.EndDate = revenue.Event.EndDate.ToString("dd-MM-yyyy"); revenueModel.StartDate = revenue.Event.StartDate.ToString("dd-MM-yyyy"); revenueModel.EventName = revenue.Event.Name; revenueModel.Revenues = revenue.Revenues; revenueModel.NoOfParticipants = revenue.NoOfPersons; return(revenueModel); }
public bool SaveRevenue(int userId, int eventId) { Event eventDb = _iEventDao.GetEvent(eventId); UserEventHistory userHistory = new UserEventHistory() { EventId = eventId, UserId = userId, NoOfPersons = 1, FlightId = eventDb.FlightId, HotelId = eventDb.HotelId }; userHistory.Revenues = (decimal)((eventDb.TicketPrice + eventDb.FlightInfo.TicketPrice + eventDb.HotelInfo.RoomPrice * eventDb.NumberOfNights) / 10); eventDb.UserEventHistories.Add(userHistory); _iEventDao.SaveContext(); return(true); }