Exemple #1
0
        public IActionResult EditFootballer(Footballer model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var Footballer = FootballerRepository.Find(model.Id);

            Footballer.FirstName = model.FirstName;
            Footballer.LastName  = model.LastName;
            Footballer.BirthDate = model.BirthDate;
            Footballer.Country   = model.Country;
            Footballer.Gender    = model.Gender;
            Footballer.TeamName  = model.TeamName;
            FootballerRepository.Update(Footballer);
            FootballerRepository.SaveChanges();

            context.Clients.All.SendAsync("refreshFootballers");
            return(RedirectToAction("index"));
        }