private static void AddAward() { Console.WriteLine("Введите Название награды:"); string title = Console.ReadLine(); Award newAward = awardLogic.Save(title); }
private static void AddAward() { Console.Write("Enter title: "); string title = Console.ReadLine(); if (title == String.Empty || title == null) { throw new ArgumentException("Name can't be null or empty", nameof(title)); } awardLogic.Save(new Award { Title = title }); Console.Write("Press any button to continue..."); Console.ReadLine(); }
internal Award Save(AwardCreateVM model) { var award = Mapper.Map <Award>(model); if (model.Image != null) { WebImage img = new WebImage(model.Image.InputStream); img.Resize(imageWidth, imageHeight); award.Image = new PictureData(); award.Image.Data = img.GetBytes(); award.Image.ContentType = "image/" + img.ImageFormat; } else// for web api { var image = new WebImage(@"D:\it2017_1\Task1\Epam.UsersAwards.MVC\Content\Images\award-default.png"); award.Image.ContentType = "image/" + image.ImageFormat; award.Image.Data = image.GetBytes(); } return(awardLogic.Save(award)); }
private static void Save(IAwardLogic logic) { Console.Clear(); logic.Save(); Console.Clear(); }