public ActionResult Save(CustomerInputModel model)
        {
            CustomerRepository repository = new CustomerRepository();

            int id = 0;

            if (model.ID > 0)
            {
                id = model.ID;
                repository.Update(id, model.Name, model.Note);
            }
            else
            {
                id = repository.Add(model.Name, model.Note);
            }

            CustomerViewModel vm = new CustomerViewModel();
            vm.ID = id.ToString();
            vm.Key = model.Key;

            return Json(vm);
        }
Beispiel #2
0
        public ActionResult Save(CustomerInputModel model)
        {
            CustomerRepository repository =
                new CustomerRepository();

            int id = 0;

            if (model.ID > 0)
            {
                id = model.ID;
                repository.Update(id, model.Name, model.Note);
            }
            else
            {
                id = repository.Add(model.Name, model.Note);
            }

            CustomerViewModel vm = new CustomerViewModel();

            vm.ID  = id.ToString();
            vm.Key = model.Key;

            return(Json(vm));
        }