public int SetTMEventAreaPrice(int areaId, decimal price) { TMEventAreaDto tmeventAreaDto = GetTMEventArea(areaId); tmeventAreaDto.Price = price; return(UpdateTMEventArea(tmeventAreaDto)); }
public PurchaseStatus ReturnTicket(string userId, int tmeventSeatId) { TMEventSeatDto seat = _tmeventSeatService.GetTMEventSeat(tmeventSeatId); TMEventAreaDto area = _tmeventAreaService.GetTMEventArea(seat.TMEventAreaId); var tmeventObj = _tmeventService.GetTMEvent(area.TMEventId); if (tmeventObj.StartEvent > DateTime.Now) { _tmeventAreaService.SetTMEventSeatState(tmeventSeatId, SeatState.Free); var ph = _purchaseHistoryRepository.GetAll() .Where(p => p.UserId.Equals(userId, StringComparison.OrdinalIgnoreCase)) .FirstOrDefault(p => p.TMEventSeatId == tmeventSeatId); if (ph != null) { _purchaseHistoryRepository.Remove(ph.Id); _userService.TopUpBalance(userId, area.Price); } return(PurchaseStatus.ReturnTicketSucsess); } return(PurchaseStatus.ReturnTicketFailWithPastEvent); }
public ActionResult SetPrice(int id, [Bind] TMEventAreaDto obj) { if (obj != null) { obj.Id = id; _tmeventAreaService.SetTMEventAreaPrice(obj.Id, obj.Price); } return(RedirectToAction("SetSeveralPrice", new { idEvent = obj?.TMEventId })); }
private static TMEventArea ConvertToEntity(TMEventAreaDto obj) { return(new TMEventArea { Id = obj.Id, CoordX = obj.CoordX, CoordY = obj.CoordY, Description = obj.Description, Price = obj.Price, TMEventId = obj.TMEventId, }); }
public List <PurchaseHistoryDto> GetPurchaseHistory(string userId) { List <PurchaseHistory> ph = _purchaseHistoryRepository.GetAll().Where(p => p.UserId == userId).ToList(); var phdto = new List <PurchaseHistoryDto>(); foreach (var item in ph) { TMEventSeatDto seat = _tmeventSeatService.GetTMEventSeat(item.TMEventSeatId); TMEventAreaDto area = _tmeventAreaService.GetTMEventArea(seat.TMEventAreaId); phdto.Add(new PurchaseHistoryDto { SeatObj = seat, BookingDate = item.BookingDate, AreaPrice = area.Price, TMEventObj = _tmeventService.GetTMEvent(area.TMEventId), }); } return(phdto); }
public TMEventAreaDto CreateTMEventArea(TMEventAreaDto obj) { return(ConvertToDto( _tmeventAreaRepository.Create(ConvertToEntity(obj)), GetTMEventSeatsByArea(obj.Id))); }
public int UpdateTMEventArea(TMEventAreaDto obj) { _tmeventAreaRepository.Update(ConvertToEntity(obj)); return(1); }