private NewsDto GenerateDto(NewsModelInput model) { var newsDto = new NewsDto { Title = model.Title, Author = User.Identity.Name, Description = model.Description, ShortDescription = model.ShortDescription, }; if (model.ImageFile != null) newsDto.Image = new ImageDto { Blob = Base64Manager.ReadFully(model.ImageFile.InputStream), MimeType = model.ImageFile.ContentType, FileName = model.ImageFile.FileName, Size = model.ImageFile.ContentLength }; return newsDto; }
public static String DecryptFromBase64(String CipherText, String Key) { byte[] CiPherBytes = Base64Manager.Base64ToByteArray(CipherText); byte[] Encrypted = DecryptRaw(CiPherBytes, Encoding.UTF8.GetBytes(Key)); return(Encoding.UTF8.GetString(Encrypted, 0, Encrypted.Length)); }
public static String EncryptToBase64(String Plaintext, String Key) { byte[] PlainBytes = Encoding.UTF8.GetBytes(Plaintext); return(Base64Manager.ToBase64(EncryptRaw(PlainBytes, Encoding.UTF8.GetBytes(Key)), false)); }