public OperationResult Edit(EditCeremony command)
        {
            var operation = new OperationResult();

            operation.IsSuccedded = false;
            ceremony = _ceremonyRepository.Get(command.Id);
            if (ceremony == null)
            {
                return(operation.Failed(ApplicationMessages.RecordNotFound));
            }

            if (_ceremonyRepository.Exist(x => x.Title == command.Title && x.Id != command.Id))
            {
                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.Edit(command.Title, command.CeremonyDate.ToGeorgianDateTime(), command.IsLive, bannerFileName,
                          imageFileName, command.ImageAlt, command.ImageTitle, command.Keywords, command.MetaDescription, slug);

            _ceremonyRepository.SaveChanges();
            CreateOperationLog(ceremony.Id, 2);
            return(operation.Succedded());
        }
Exemplo n.º 2
0
 public OperationResult Edit(EditCeremony command)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 3
0
        public JsonResult OnPostEdit(EditCeremony command)
        {
            var result = _ceremonyApplication.Edit(command);

            return(new JsonResult(result));
        }