コード例 #1
0
        private static void AddAward()
        {
            Console.WriteLine("Введите Название награды:");
            string title = Console.ReadLine();

            Award newAward = awardLogic.Save(title);
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        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));
        }
コード例 #4
0
 private static void Save(IAwardLogic logic)
 {
     Console.Clear();
     logic.Save();
     Console.Clear();
 }