Exemple #1
0
        public FIL.Contracts.DataModels.TicketCategory SaveTicketCategory(CreateTicketCommand command, FIL.Contracts.Models.CreateEventV1.TicketModel ticketModel)
        {
            var ticketCat = _ticketCategoryRepository.GetByNameAndId(ticketModel.Name, ticketModel.TicketCategoryId);

            if (ticketCat == null) // if category exists with same name
            {
                FIL.Contracts.DataModels.TicketCategory ticketCategoryObject = new FIL.Contracts.DataModels.TicketCategory();
                ticketCategoryObject.Name       = ticketModel.Name;
                ticketCategoryObject.IsEnabled  = true;
                ticketCategoryObject.CreatedUtc = DateTime.UtcNow;
                ticketCategoryObject.CreatedBy  = command.ModifiedBy;
                ticketCategoryObject.ModifiedBy = command.ModifiedBy;
                var ticketCategory = _ticketCategoryRepository.Save(ticketCategoryObject);
                return(ticketCategory);
            }
            else
            {
                return(ticketCat);
            }
        }