public OperationResult Create(CreateCeremony command)
        {
            var operation = new OperationResult();

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

            var slug = command.Slug.Slugify();

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

            ceremony = new Ceremony(command.Title, command.CeremonyDate.ToGeorgianDateTime(), command.IsLive, bannerFileName,
                                    imageFileName, command.ImageAlt, command.ImageTitle, command.Keywords, command.MetaDescription, slug);
            CreateOperationLog(ceremony.Id, 1);
            _ceremonyRepository.Create(ceremony);
            _ceremonyRepository.SaveChanges();
            return(operation.Succedded());
        }
示例#2
0
 public OperationResult Create(CreateCeremony command)
 {
     _ceremonyRepository.Create();
 }
示例#3
0
        public JsonResult OnPostCreate(CreateCeremony command)
        {
            var result = _ceremonyApplication.Create(command);

            return(new JsonResult(result));
        }