public void Create(Ticket ticket) { try { var mapTicket = AutoMapper.Mapper.Map <Data.Entities.Ticket>(ticket); _ticketRepository.Add(mapTicket); _unitOfWork.Commit(); } catch (Exception exception) { throw new FaultException(exception.Message); } }
public void Update(Ticket ticket) { try { var mapTicket = AutoMapper.Mapper.Map <Data.Entities.Ticket>(ticket); var actualTicket = _ticketRepository .FindBy(t => t.Id == mapTicket.Id) .First(); actualTicket.Name = mapTicket.Name; actualTicket.Price = mapTicket.Price; actualTicket.Duration = mapTicket.Duration; actualTicket.TicketTypeId = mapTicket.TicketTypeId; actualTicket.IsDeleted = mapTicket.IsDeleted; _unitOfWork.Commit(); } catch (Exception exception) { throw new FaultException(exception.Message); } }