public CharacterClassViewModel UpdateClass(int id, CharacterClassViewModel characterClass)
 {
     var originalCharacterClass = _characterClassRepository.GetById(id);
     CharacterClassMapper.MapModelToEntity(characterClass, originalCharacterClass);
     originalCharacterClass.ModifiedBy = "TEST";
     var updatedCharacterClass = _characterClassRepository.Update(originalCharacterClass);
     return CharacterClassMapper.MapEntityToModel(updatedCharacterClass);
 }
 public CharacterClassViewModel AddClass(CharacterClassViewModel characterClass, string userId)
 {
     var characterClassToAdd = CharacterClassMapper.MapModelToEntity(characterClass);
     characterClassToAdd.CreatedBy = userId;
     characterClassToAdd.SeedData = false;
     var addedCharacterClass = _characterClassRepository.Add(characterClassToAdd);
     return CharacterClassMapper.MapEntityToModel(addedCharacterClass);
 }
        public ActionResult Edit(int id, CharacterClassViewModel characterClass)
        {
            try
            {
                _characterClassService.UpdateClass(id, characterClass);

                return RedirectToAction("Index");
            }
            catch
            {
                return View(characterClass);
            }
        }
        public ActionResult Create(CharacterClassViewModel characterClass)
        {
            try
            {
                _characterClassService.AddClass(characterClass, User.Identity.GetUserId());

                return RedirectToAction("Index");
            }
            catch
            {
                return View(characterClass);
            }
        }
 // GET: Classes/Create
 public ActionResult Create()
 {
     var model = new CharacterClassViewModel();
     return View(model);
 }
 public static void MapModelToEntity(CharacterClassViewModel characterClass, CharacterClass originalCharacterClass)
 {
     Mapper.Map(characterClass, originalCharacterClass);
 }
 public static CharacterClass MapModelToEntity(CharacterClassViewModel characterClass)
 {
     return Mapper.Map<CharacterClass>(characterClass);
 }