Exemplo n.º 1
0
 public ActionResult Create(FormCollection collection)
 {
     return(userTypeService.Authorize(() =>
     {
         boardGamesService.AddBoardGame(new DAL.Models.BoardGame()
         {
             Name = collection["Name"],
             Description = collection["Description"],
             Content = collection["Content"],
             MinimumAge = int.Parse(collection["MinimumAge"]),
             GameTimeInMinutes = int.Parse(collection["GameTimeInMinutes"]),
             MinPlayerCount = int.Parse(collection["MinPlayerCount"]),
             MaxPlayerCount = int.Parse(collection["MaxPlayerCount"]),
             BoardGamePublisherId = int.Parse(collection.GetValue("BoardGamePublisher").AttemptedValue),
             BoardGameStateId = int.Parse(collection.GetValue("BoardGameState").AttemptedValue),
             BoardGameCategoryId = int.Parse(collection.GetValue("BoardGameCategory").AttemptedValue),
             ImagePath = collection["ImagePath"],
             DetailsImagePath = collection["DetailsImagePath"]
         });
         return RedirectToAction(nameof(BoardGamesCollection));
     }, UserType.Administrator, UserType.Employee));
 }