Exemple #1
0
        public ActionResult Edit(int id, ModelViewMatch match)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var updateMatch = Mapper.Map <ModelViewMatch, Match>(match);
                    _repo.Update(updateMatch);

                    return(RedirectToAction("Index"));
                }
                catch
                {
                    return(View(match));
                }
            }
            return(View(match));
        }
Exemple #2
0
        public ActionResult Create(ModelViewMatch match)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var newMatch = Mapper.Map <ModelViewMatch, Match>(match);
                    _repo.Add(newMatch);

                    return(RedirectToAction("Index"));
                }
                catch
                {
                    return(View(match));
                }
            }
            return(View(match));
        }