Example #1
0
        public async Task <PlaceCalendarResponseViewModel> SavePlaceCalendar([FromBody] PlaceCalendarRequestViewModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    PlaceCalendarCommandResult placeCalendarResult = await _commandSender.Send <PlaceCalendarCommand, PlaceCalendarCommandResult>(new PlaceCalendarCommand
                    {
                        PlaceAltId       = model.PlaceAltId,
                        VenueAltId       = model.VenueAltId,
                        HolidayDates     = model.HolidayDates,
                        WeekOffDays      = model.WeekOffDays,
                        PlaceStartDate   = model.PlaceStartDate,
                        PlaceEndDate     = model.PlaceEndDate,
                        PlaceType        = model.PlaceType,
                        IsEdit           = model.IsEdit,
                        IsNewCalendar    = model.IsNewCalendar,
                        PlaceTimings     = AutoMapper.Mapper.Map <List <FIL.Contracts.Commands.PlaceCalendar.Timing> >(model.PlaceTimings),
                        RegularTimeModel = AutoMapper.Mapper.Map <FIL.Contracts.Commands.PlaceCalendar.RegularViewModel>(model.RegularTimeModel),
                        SeasonTimeModel  = AutoMapper.Mapper.Map <List <FIL.Contracts.Commands.PlaceCalendar.SeasonViewModel> >(model.SeasonTimeModel),
                        SpecialDayModel  = AutoMapper.Mapper.Map <List <FIL.Contracts.Commands.PlaceCalendar.SpecialDayViewModel> >(model.SpecialDayModel),
                    });

                    return(new PlaceCalendarResponseViewModel
                    {
                        Success = true
                    });
                }
                catch (Exception e)
                {
                    return(new PlaceCalendarResponseViewModel {
                    });
                }
            }
            else
            {
                return(new PlaceCalendarResponseViewModel {
                });
            }
        }
Example #2
0
        public async Task <InventoryResponseViewModel> saveEventDetailCreation([FromBody] EventDetailCreationViewModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var session = await _sessionProvider.Get();

                    var startDateTime = new DateTime(model.EventCalendar.PlaceStartDate.Year, model.EventCalendar.PlaceStartDate.Month, model.EventCalendar.PlaceStartDate.Day, Convert.ToInt32(model.EventCalendar.RegularTimeModel.TimeModel.FirstOrDefault().From.Split(":")[0]), Convert.ToInt32(model.EventCalendar.RegularTimeModel.TimeModel.FirstOrDefault().From.Split(":")[1]), 0);
                    var EndDateTime   = new DateTime(model.EventCalendar.PlaceStartDate.Year, model.EventCalendar.PlaceStartDate.Month, model.EventCalendar.PlaceStartDate.Day, Convert.ToInt32(model.EventCalendar.RegularTimeModel.TimeModel.FirstOrDefault().To.Split(":")[0]), Convert.ToInt32(model.EventCalendar.RegularTimeModel.TimeModel.FirstOrDefault().To.Split(":")[1]), 0);
                    if (!model.EventCalendar.TimeZone.Contains("-"))
                    {
                        model.EventCalendar.TimeZone = "+" + model.EventCalendar.TimeZone;
                    }
                    if (model.EventCalendar.TimeZone != null && model.EventCalendar.TimeZone.Contains("+"))
                    {
                        var time = Convert.ToInt64(model.EventCalendar.TimeZone.Replace("+", ""));
                        startDateTime = startDateTime.AddMinutes(-time);
                        EndDateTime   = EndDateTime.AddMinutes(-time);
                    }
                    else if (model.EventCalendar.TimeZone != null && model.EventCalendar.TimeZone.Contains("-"))
                    {
                        var time = Convert.ToInt64(model.EventCalendar.TimeZone.Replace("-", ""));
                        startDateTime = startDateTime.AddMinutes(time);
                        EndDateTime   = EndDateTime.AddMinutes(time);
                    }

                    SaveEventDataResult EventData = await _commandSender.Send <SaveEventCommand, SaveEventDataResult>(new SaveEventCommand
                    {
                        IsEventCreation = true,
                        Id                     = model.EventId,
                        AltId                  = Guid.NewGuid(),
                        Name                   = model.Title,
                        Description            = model.EventDescription,
                        TermsAndConditions     = "NA",
                        EventCategoryId        = 98,
                        EventType              = (EventType)1,
                        MetaDetails            = "",
                        IsEnabled              = true,
                        IsFeel                 = true,
                        ClientPointOfContactId = 1,
                        TagIds                 = "",
                        SubCategoryIds         = model.EventCategoryId,
                        AmenityIds             = "",
                        TimeDuration           = "02:00-04:00",
                        IsEdit                 = model.IsEdit,
                        ModifiedBy             = session.User != null ? session.User.AltId : Guid.Parse("7390283B-4A32-4860-BA3D-B57F1E5F2DAC"),
                    });

                    if (!model.IsEdit)
                    {
                        await _commandSender.Send <LocationCommand, LocationCommandResult>(new LocationCommand
                        {
                            PlaceName                = model.Title,
                            Title                    = model.Title,
                            Location                 = "1-5 Wheat Road, Darling Harbour",
                            Country                  = "Australia",
                            State                    = "New South Wales",
                            City                     = "Sydney",
                            Address1                 = "1-5 Wheat Road, Darling Harbour",
                            Address2                 = "1-5 Wheat Road, Darling Harbour",
                            EventId                  = EventData.Id,
                            IsEdit                   = model.IsEdit,
                            Lat                      = "-33.869598",
                            Long                     = "151.201577",
                            Zip                      = "411028",
                            TilesSliderImages        = "",
                            DescpagebannerImages     = "",
                            InventorypagebannerImage = "",
                            GalleryImages            = "",
                            PlacemapImages           = "",
                            TimelineImages           = "",
                            ArchdetailImages         = "",
                            ParentCategoryId         = 98,
                            TimeZoneAbbreviation     = model.EventCalendar.TimeZoneAbbreviation,
                            TimeZone                 = model.EventCalendar.TimeZone
                        });

                        PlaceCalendarCommandResult placeCalendarResult = await _commandSender.Send <PlaceCalendarCommand, PlaceCalendarCommandResult>(new PlaceCalendarCommand
                        {
                            IsEventCreation  = true,
                            PlaceAltId       = EventData.AltId,
                            VenueAltId       = model.EventCalendar.VenueAltId,
                            HolidayDates     = model.EventCalendar.HolidayDates,
                            WeekOffDays      = model.EventCalendar.WeekOffDays,
                            PlaceStartDate   = startDateTime,
                            PlaceEndDate     = EndDateTime,
                            PlaceType        = model.EventCalendar.PlaceType,
                            IsEdit           = model.EventCalendar.IsEdit,
                            IsNewCalendar    = model.EventCalendar.IsNewCalendar,
                            PlaceTimings     = AutoMapper.Mapper.Map <List <FIL.Contracts.Commands.PlaceCalendar.Timing> >(model.EventCalendar.PlaceTimings),
                            RegularTimeModel = AutoMapper.Mapper.Map <FIL.Contracts.Commands.PlaceCalendar.RegularViewModel>(model.EventCalendar.RegularTimeModel),
                            SeasonTimeModel  = AutoMapper.Mapper.Map <List <FIL.Contracts.Commands.PlaceCalendar.SeasonViewModel> >(model.EventCalendar.SeasonTimeModel),
                            SpecialDayModel  = AutoMapper.Mapper.Map <List <FIL.Contracts.Commands.PlaceCalendar.SpecialDayViewModel> >(model.EventCalendar.SpecialDayModel),
                        });
                    }
                    var eventHostCommandResult = await _commandSender.Send <EventHostCommand, EventHostCommandResult>(new EventHostCommand
                    {
                        EventHostMappings = model.EventHosts,
                        EventId           = EventData.Id,
                        ModifiedBy        = session.User != null ? session.User.AltId : Guid.Parse("7390283B-4A32-4860-BA3D-B57F1E5F2DAC")
                    });

                    return(new InventoryResponseViewModel
                    {
                        Success = true,
                        EventAltId = EventData.AltId,
                        EventHosts = eventHostCommandResult.EventHostMappings
                    });
                }
                catch (Exception e)
                {
                    return(new InventoryResponseViewModel {
                    });
                }
            }
            else
            {
                return(new InventoryResponseViewModel {
                });
            }
        }