public ActionResult Save(AccountTypeViewModel vm)
        {
            var accountType = Mapper.Map(vm, new AccountType());
            if (ModelState.IsValid)
            {
                string mensaje = "";
                if (accountType.Id > 0)
                {
                    db.AccountTypes.Attach(accountType);
                    db.Entry(accountType).State = EntityState.Modified;
                    db.SaveChanges();
                    mensaje = "Datos Actualizados.";
                }
                else
                {
                    db.AccountTypes.Add(accountType);
                    db.SaveChanges();
                    mensaje = "Registro Creado";
                }
                vm.Id = accountType.Id;
                return Json(new { Result = "OK", Data = vm, Message = mensaje });
            }

            return Json(new { Result = "ERROR", Message = "Hay Datos erroneos" });
        }
 public ActionResult Delete(AccountTypeViewModel vm)
 {
     try
     {
         var accountType = Mapper.Map(vm, new AccountType());
         db.AccountTypes.Attach(accountType);
         db.AccountTypes.Remove(accountType);
         db.SaveChanges();
         return Json(new { Result = "OK", Message = "Elemento Eliminado." });
     }
     catch (Exception ex)
     {
         return Json(new { Result = "Error", Message = ex.StackTrace });
     }
 }