public string GetBattleTableData()
        {
            IRepository <Battle> repo = new BattleRepository();
            var config = new MapperConfiguration(cfg => cfg.CreateMap <Battle, BattleViewModel>());
            var mapper = new Mapper(config);
            List <BattleViewModel> battlesViewList = mapper.Map <List <BattleViewModel> >(repo.GetAll());

            return(JsonConvert.SerializeObject(battlesViewList));
        }
        public ActionResult EditBattle(int?id)
        {
            IRepository <Battle> repo  = new BattleRepository();
            var             config     = new MapperConfiguration(cfg => cfg.CreateMap <Battle, BattleViewModel>());
            var             mapper     = new Mapper(config);
            BattleViewModel battleView = mapper.Map <Battle, BattleViewModel>(repo.Get(id.Value));

            return(View("~/Views/Home/Battle.cshtml", battleView));
        }
        public string GetData()
        {
            BattleRepository repo = new BattleRepository();
            var config            = new MapperConfiguration(cfg => cfg.CreateMap <Rating, RatingViewModel>());
            var mapper            = new Mapper(config);
            List <RatingViewModel> ratingsList = mapper.Map <List <RatingViewModel> >(repo.GetAllBoxerRating());

            return(JsonConvert.SerializeObject(ratingsList));
        }
        public ActionResult EditBattle(BattleViewModel model)
        {
            IRepository <Battle> repo = new BattleRepository();
            var    config             = new MapperConfiguration(cfg => cfg.CreateMap <BattleViewModel, Battle>());
            var    mapper             = new Mapper(config);
            Battle battle             = mapper.Map <BattleViewModel, Battle>(model);

            repo.Update(battle);
            repo.Save();
            return(RedirectToAction("GetBattlePage"));
        }