Exemplo n.º 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));
        }
Exemplo n.º 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());
        }
Exemplo n.º 3
0
        public JsonResult OnPostCreate(CreateGuest command)
        {
            var result = _guestApplication.Create(command);

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