Example #1
0
        public IActionResult Index(LookupViewModel vm, string buttonValue)
        {
            switch (buttonValue)
            {
            case "Save":
                if (ModelState.IsValid)
                {
                    vm.EditLookup.GroupId = vm.SelectedGroupId;
                    LookupRepo.SaveLookup(vm.EditLookup);
                    vm.EditLookup = new TimeCard.Domain.Lookup();
                    ModelState.Clear();
                }
                break;

            case "Delete":
                LookupRepo.DeleteLookup(vm.EditLookup.Id);
                break;

            default:
                vm.EditLookup = new TimeCard.Domain.Lookup();
                ModelState.Clear();
                break;
            }
            prepIndex(vm);
            return(View(vm));
        }