Example #1
0
        public ActionResult DeleteFootballPlayerCulture(int footballPlayerId, int cultureId)
        {
            FootballPlayerCultureViewModel vm = _adminService.GetFootballPlayerCultureViewById(footballPlayerId, cultureId);

            vm.PreviousLink = this.Url.Action("EditFootballPlayer", "Admin", new { footballPlayerId }, this.Request.Url.Scheme);

            return(View(vm));
        }
Example #2
0
        public void AddFootballPlayerCulture(FootballPlayerCultureViewModel model)
        {
            FootballPlayerCulture player = AutoMapper.Mapper.Map <FootballPlayerCulture>(model);

            player.CDate = DateTime.Now;
            UnitOfWork.FootballPlayerCultures.Add(player);
            UnitOfWork.SaveChanges();
            UnitOfWork.ReloadContext();
        }
Example #3
0
        public ActionResult AddFootballPlayerCulture(int footballPlayerId)
        {
            FootballPlayerCultureViewModel footballPlayerCultureVm = new FootballPlayerCultureViewModel();

            footballPlayerCultureVm.FootballPlayerId = footballPlayerId;
            footballPlayerCultureVm.PreviousLink     = this.Url.Action("EditFootballPlayer", "Admin", new { footballPlayerId }, this.Request.Url.Scheme);

            ViewBag.Cultures = _adminService.GetCultures();

            return(View(footballPlayerCultureVm));
        }
Example #4
0
        public ActionResult EditFootballPlayerCulture([Bind(Include = "FootballPlayerId, FirstName, SecondName, LastName, CultureId")] FootballPlayerCultureViewModel model)
        {
            if (!ModelState.IsValid)
            {
                model.PreviousLink = this.Url.Action("EditFootballPlayer", "Admin", new { footballPlayerId = model.FootballPlayerId }, this.Request.Url.Scheme);

                return(View(model));
            }

            _adminService.UpdateFootballPlayerCulture(model);

            return(RedirectToAction("EditFootballPlayerCulture", new { footballPlayerId = model.FootballPlayerId, cultureId = model.CultureId }));
        }
Example #5
0
        public void UpdateFootballPlayerCulture(FootballPlayerCultureViewModel model)
        {
            var playerCultureFromDb =
                UnitOfWork.FootballPlayerCultures.FirstOrDefault(
                    x => x.PlayerId == model.FootballPlayerId && x.CultureId == model.CultureId);

            if (playerCultureFromDb == null)
            {
                throw new ArgumentNullException("Not found in database!");
            }

            playerCultureFromDb.FirstName  = model.FirstName;
            playerCultureFromDb.SecondName = model.SecondName;
            playerCultureFromDb.LastName   = model.LastName;

            UnitOfWork.SaveChanges();
        }
Example #6
0
        public ActionResult DeleteFootballPlayerCulture([Bind(Include = "FootballPlayerId, CultureId")] FootballPlayerCultureViewModel model)
        {
            _adminService.DeleteFootballPlayerCulture(model.FootballPlayerId, model.CultureId);

            return(RedirectToAction("EditFootballPlayer", new { footballPlayerId = model.FootballPlayerId }));
        }