private void Save(Models.GenTestHasCat record, bool isNew)
 {
     // add any code to update other fields/tables here
     record.Save();
     // save subform or related checkboxes here eg record.Lines.Save();
     //ifsubform: record.example.Save();
     CheckLock(record);
     lockobj.UnLockTable(record.GetTableName(), record.ID);
 }
        protected ActionResult ProcessForm(Models.GenTestHasCat record)
        {
            try {
                record.UpdateFromRequest();
                // read subform or related checkboxes here eg record.Lines.UpdateFromRequest();
                //ifsubform: record.example.UpdateFromRequest();

                Validate(record);
                if (ModelState.IsValid)
                {
                    Save(record, record.IsNewRecord);
                    Web.InfoMessage += "Gen Test Has Cat " + record.GetName() + " saved.";
                }
            } catch (UserErrorException e) {
                ModelState.AddModelError("Record", e.Message);
            }

            if (!ModelState.IsValid)
            {
                // invalid so redisplay form with validation message(s)
                return(View("GenTestHasCatEdit", record));
            }
            else if (Web.Request["SaveAndRefreshButton"] != null)
            {
                return(RedirectToEdit(record.ID));
            }
            else if (Web.Request["DuplicateButton"] != null)
            {
                var newRecord = new Models.GenTestHasCat();
                newRecord.UpdateFrom(record);
                newRecord.Save();
                Web.InfoMessage += "Copy of Gen Test Has Cat " + record.GetName() + " created. You are now editing the new copy.";
                return(RedirectToEdit(newRecord.ID));
            }
            else
            {
                return(RedirectToReturnPage());
            }
        }