示例#1
0
        public IActionResult OnGetCreate()
        {
            var command = new CreateCeremonyGuest
            {
                Ceremonies = _ceremonyApplication.GetCeremonies(),
                //Guests = _guestApplication.GetGuests()
            };

            return(Partial("./Create", command));
        }
示例#2
0
        public JsonResult OnPostCreate(CreateCeremonyGuest command)
        {
            var result    = _ceremonyGuestApplication.Create(command);
            var ceremony  = _ceremonyApplication.GetDetail(command.CeremonyId);
            var guests    = _ceremonyGuestApplication.GetCeremonyGuests(command.CeremonyId);
            var guestInfo = _guestApplication.GetGuestsInfo(guests);

            foreach (var item in guestInfo)
            {
                _emailService.SendEmail(ceremony.Title, " جناب آقای دعوتنامه شرکت در در مراسم", item.Email);
            }

            return(new JsonResult(result));
        }
示例#3
0
        public OperationResult Create(CreateCeremonyGuest command)
        {
            var operation = new OperationResult();

            if (_ceremonyGuestRepository.Exist(x => x.GuestId == command.GuestId && x.CeremonyId == command.CeremonyId))
            {
                return(operation.Failed(ApplicationMessages.DuplicatedRecord));
            }

            var ceremonyGuest = new CeremonyGuest(command.GuestId, command.CeremonyId, command.Satisfication);

            _ceremonyGuestRepository.Create(ceremonyGuest);
            _ceremonyGuestRepository.SaveChanges();
            return(operation.Succedded());
        }