public bool CreateAward(CreateAwardVM award, HttpRequestBase request) { Guid imageId = Guid.Empty; var newAward = Mapper.Map <AwardDTO>(award); var uploaded = request.Files["Uploaded"]; if (uploaded == null || uploaded.ContentLength == 0) { return(false); } byte[] bytes = new byte[uploaded.ContentLength]; uploaded.InputStream.Read(bytes, 0, uploaded.ContentLength); var img = new ImageDTO() { OwnerId = Guid.NewGuid(), Data = bytes, Type = uploaded.ContentType }; imageId = Addimage(img); newAward.ImageId = imageId; int newAwardId = awardBll.AddAward(newAward); return(newAwardId >= ModelRules.LowerBoundOfId); }
public static void AddAward() { Console.WriteLine("Enter award's title"); var title = Console.ReadLine(); awardLogic.AddAward(title); }
public ActionResult AddAward(AwardModel model) { ViewBag.Message = "AddAward"; if (ModelState.IsValid) { awardLogic.AddAward(model.Title, new List <int>()); return(RedirectToAction("Index")); } return(View()); }
//добавление информации private static void Adding() { while (true) { Console.WriteLine(); Console.WriteLine($"1: Add user"); Console.WriteLine($"2: Add award"); Console.WriteLine($"3: HELP"); Console.WriteLine($"4: EXIT"); Console.Write($"Choose action: "); var userAction = Console.ReadLine(); switch (userAction) { case "1": Console.Write($"User's Name: "); var name = Console.ReadLine(); Console.Write($"User's Birthday: "); var birthday = Console.ReadLine(); Console.Write($"User's Email: "); if (userLogic.AddUser(name, birthday, null) != default) { Console.WriteLine($"User is created!{Environment.NewLine}"); } else { Console.WriteLine($"User isn't created!{Environment.NewLine}"); } break; case "2": Console.Write($"Award's Title: "); var title = Console.ReadLine(); Console.Write($"Award's Description: "); var description = Console.ReadLine(); awardLogic.AddAward(title, description, null); Console.WriteLine($"Award is created!{Environment.NewLine}"); break; case "3": Console.WriteLine($"HELP YOURSELF"); break; case "4": return; default: Console.WriteLine("I don't know this comuserd"); break; } } }
public static void AddAward() { Console.WriteLine("Введите название"); var title = Console.ReadLine(); var currentAward = new Award { Title = title, }; awardLogic.AddAward(currentAward); }
private static void AddAward(IAwardLogic awardlogic) { string name; Console.WriteLine("Enter a name of award"); name = Console.ReadLine(); var award = new Award { Title = name }; awardlogic.AddAward(award); }
private static void AddAward(IAwardLogic awardlogic) { try { Console.Write("Enter Title: "); var awardTitle = Console.ReadLine(); awardlogic.AddAward(new Award(awardTitle)); } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.WriteLine(); }