Ejemplo n.º 1
0
        public bool SaveTicketType(TicketType ticketType)
        {
            if (ticketType.TicketTypeId > 0)
            {
                ticketTypeRepository.Update(ticketType);
            }
            else
            {
                ticketTypeRepository.Add(ticketType);
            }

            ticketTypeRepository.SaveChanges();
            return(true);
        }
Ejemplo n.º 2
0
        public bool CreateTicketType(TicketTypeCreateViewModel model)
        {
            var ticketType = _mapper.Map <TicketTypeCreateViewModel, TicketType>(model);

            if (_ticketTypeRepository.Get(x => x.Deleted == false && x.Name.Equals(model.Name, StringComparison.OrdinalIgnoreCase)) == null)
            {
                ticketType.CreatedAtUTC = DateTime.UtcNow;
                ticketType.UpdatedAtUTC = DateTime.UtcNow;
                _ticketTypeRepository.Add(ticketType);
                _unitOfWork.CommitChanges();
                return(true);
            }
            return(false);
        }
        public IActionResult SaveNew(NewTicketTypeVM Model)
        {
            if (!ModelState.IsValid)
            {
                return(View("New"));
            }
            TicketType ticketType = new TicketType()
            {
                Name        = Model.Name,
                Price       = Model.Price,
                Description = Model.Description,
                Tier        = Model.Tier
            };

            _repo.Add(ticketType);

            return(RedirectToAction("List"));
        }
Ejemplo n.º 4
0
 public void AddTicketType(TicketType TicketType)
 {
     _iRespository.Add(TicketType);
 }