public IHttpActionResult GetStickerById(int Id) { var Sticker = StickerService.GetSticker(Id); if (Sticker != null) { return(Ok(Sticker)); } return(NotFound()); }
public IActionResult Edit(int id) { var sticker = _stickerService.GetSticker(id); var addedEmoji = sticker.Emoji.Select(p => p.Emoji).ToList(); var notAddedEmoji = _emojiService.GetAll().Except(addedEmoji).ToList(); var keyboardEmoji = _keyboardService.GetActiveKeyboardEmojis(); var notAddedKeyboardEmojis = notAddedEmoji.Intersect(keyboardEmoji).ToList(); var otherEmojis = notAddedEmoji.Except(notAddedKeyboardEmojis); var model = new StickersEditModel { Id = sticker.Id, PhotoUrl = sticker.AzureImageUrl, StickerSetTitle = sticker.StickerSet.Title, CreatedDate = sticker.CreatedDate.ToString(CultureInfo.CurrentCulture), StickerSetId = sticker.StickerSet.Id, AddedEmoji = sticker.Emoji.Select(p => new EmojiStickersEditModel { Id = p.Emoji.Id, Symbol = p.Emoji.Symbol, ConnectionId = p.Id }), KeyboardEmoji = notAddedKeyboardEmojis.Select(p => new EmojiStickersEditModel { Id = p.Id, Symbol = p.Symbol }), OtherEmoji = otherEmojis.Select(p => new EmojiStickersEditModel { Id = p.Id, Symbol = p.Symbol }) }; return(View(model)); }