public IActionResult UserDetails([FromForm] EventUserInfo UserInfo)
        {
            try
            {
                EventUserInfo user = new EventUserInfo();
                user.UserName = UserInfo.UserName;
                user.Password = UserInfo.Password;
                user.Email_Id = UserInfo.Email_Id;
                _context.EventUserInfos.Add(user);
                _context.SaveChanges();

                return(Ok(UserInfo));
            }
            catch (Exception ex)
            {
                return(Problem(ex.GetType().Name + " : UserName Already Exists"));
            }
        }
Exemplo n.º 2
0
        public IActionResult EditEvent(int id, string name, string description, Place place, DateTime?startDate, DateTime?endDate, EventPriceType?eventPriceType, Decimal?price, string imageURL, EventType?eventType, EventCategory?eventCategory, int?ticketCount)
        {
            EventCatalog match = eventCatalogContext.Eventcatalogs.Find(id);

            if (match == null)
            {
                return(NotFound());
            }

            if (name != null && name != match.Name)
            {
                match.Name = name;
            }

            if (description != null && description != match.Description)
            {
                match.Description = description;
            }

            if (place != null && place != match.Place)
            {
                match.Place = place;
            }

            if (startDate != null && startDate != match.StartDate)
            {
                match.StartDate = (DateTime)startDate;
            }

            if (endDate != null && endDate != match.EndDate)
            {
                match.EndDate = (DateTime)endDate;
            }

            if (eventPriceType != null && eventPriceType != match.PriceType)
            {
                match.PriceType = (EventPriceType)eventPriceType;
            }

            if (price != null && price != match.Price)
            {
                match.Price = (Decimal)price;
            }

            if (imageURL != null && imageURL != match.ImageURL)
            {
                match.ImageURL = imageURL;
            }

            if (eventType != null & eventType != match.Type)
            {
                match.Type = (EventType)eventType;
            }

            if (eventCategory != null & eventCategory != match.Category)
            {
                match.Category = (EventCategory)eventCategory;
            }

            if (ticketCount != null && ticketCount != match.InitialTicketCount)
            {
                match.InitialTicketCount = (int)ticketCount;
            }

            eventCatalogContext.SaveChanges();

            return(Ok(match));
        }