Exemple #1
0
        public ActionResult Post([FromForm] ArticlesCategoriesDto category)
        {
            category.ProfilePicture = _attachmentManager.Save(new SavedFileDto
            {
                attachmentType = AttachmentTypesEnum.Articles_Categories,
                CanChangeName  = true,
                File           = category.ProfilePictureFile
            });

            var success = _Manager.Insert(category);

            return(Ok(success));
        }
Exemple #2
0
        public ActionResult <ResultMessage> Put(int id, [FromForm] ArticlesCategoriesDto category)
        {
            if (category.ProfilePictureFile != null)
            {
                _attachmentManager.Delete(Uri.UnescapeDataString(category.ProfilePicture));
                category.ProfilePicture = _attachmentManager.Save(new SavedFileDto
                {
                    attachmentType = AttachmentTypesEnum.Articles_Categories,
                    CanChangeName  = true,
                    File           = category.ProfilePictureFile
                });
            }

            return(GetStatusCodeResult(_Manager.Update(category, id)));
        }