Example #1
0
        public async Task <Response <int> > Handle(CreateGuest command)
        {
            var request = new InsertPartyGuestRequest
            {
                PartyId       = command.PartyId,
                PersonId      = command.PersonId,
                ChosenDrinkId = command.ChosenDrinkId,
                IsVIP         = command.IsVip
            };

            var newPartyId = await _dataProvider.InsertPartyGuest(request);

            return(SuccessHandler.ReturnInsertSuccess(newPartyId, EntityName));
        }
Example #2
0
        public OperationResult Create(CreateGuest command)
        {
            var operation = new OperationResult();

            if (_guestRepository.Exist(x => x.FullName == command.FullName))
            {
                return(operation.Failed(ApplicationMessages.DuplicatedRecord));
            }

            var slug = command.FullName.Slugify();

            var ImageFolderName = Tools.ToFolderName(this.GetType().Name);
            var ImagePath       = $"{ImageFolderName}/{slug}";
            var imageFileName   = _fileUploader.Upload(command.Image, ImagePath);

            var guest = new Guest(command.FullName, command.Tel, command.Email, imageFileName, command.ImageAlt,
                                  command.ImageTitle, command.GuestType, command.Coordinator);

            _guestRepository.Create(guest);
            _guestRepository.SaveChanges();
            return(operation.Succedded());
        }
        public JsonResult OnPostCreate(CreateGuest command)
        {
            var result = _guestApplication.Create(command);

            return(new JsonResult(result));
        }
Example #4
0
 public Task <Response <int> > CreateGuest(CreateGuest command)
 {
     return(_appLayer.Execute(command));
 }