Пример #1
0
        public ActionResult Delete(long id)
        {
            var frm = formService.GetForm(id);

            if (frm != null)
            {
                var frmfield = formService.GetFormFieldsByFormId(frm.Id);
                foreach (var item in frmfield)
                {
                    formFieldService.DeleteFormField(item.Id);
                }
                formFieldService.SaveFormField();
                formService.DeleteForm(id);
                formService.SaveForm();
                return(RedirectToAction("Index"));
            }
            return(RedirectToAction("Index"));
        }
Пример #2
0
        public IActionResult Delete(long id)
        {
            var frmField = formFieldService.GetFormField(id);

            if (frmField != null)
            {
                var formFields = formService.GetFormFieldsByFormId((long)frmField.FormId);
                foreach (var formField in formFields)
                {
                    if (formField.Position > frmField.Position)
                    {
                        formField.Position = formField.Position - 1;
                    }
                    formFieldService.UpdateFormField(formField);
                }
                formFieldService.DeleteFormField(id);
                formFieldService.SaveFormField();
                return(RedirectToAction("Index"));
            }
            return(RedirectToAction("Index"));
        }