public async Task <IActionResult> UploadMeme([FromBody] MemeUploadVM model) { string userId = User.Claims.First(c => c.Type == "UserID").Value; await _memeService.Upload(model, userId); return(Ok(new { successMessage = "New meme added" })); }
public async Task <Result <Meme> > Upload(MemeUploadVM model, string userId) { var meme = new Meme() { Title = model.Title, UserID = userId, Txt = model.Txt, CategoryId = model.CategoryId, ImageName = model.FileName, ByteHead = model.ByteHead, ImageByte = model.FileByte, CreationDate = DateTime.Now, IsAccepted = false, IsArchived = false, AccpetanceDate = null, }; return(await Insert(meme)); }