示例#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();
 }