Ejemplo n.º 1
0
        public FormViewModel DeleteForm(DeleteFormRequest formIds)
        {
            DeleteFormRequest request = new DeleteFormRequest()
            {
                FormIDs = formIds.FormIDs
            };
            DeleteFormResponse response = formService.DeleteForm(request);

            return(response.FormViewModel);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> DeleteFormAsync([FromQuery] DeleteFormRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(Ok(CreateFailed(GetModelStateErrors())));
            }

            var response = await mediator.Send(request);

            return(Ok(response));
        }
Ejemplo n.º 3
0
        public void DeleteForm_ValidForm_Succeed()
        {
            int[] DeleteFormAray = FormMockData.GetDeleteFormRequest();
            mockFormRepository.Setup(mnt => mnt.DeactivateForm(It.IsAny <int[]>())).Verifiable();
            DeleteFormRequest req = new DeleteFormRequest()
            {
                FormIDs = DeleteFormAray
            };
            DeleteFormResponse response = formService.DeleteForm(req);

            mockRepository.VerifyAll();
        }
Ejemplo n.º 4
0
        public object DeleteForm(DeleteFormRequest request)
        {
            // Variables.
            var result = default(object);


            // Catch all errors.
            try
            {
                // Variables.
                var formId  = GuidHelper.GetGuid(request.FormId);
                var configs = ConFormPersistence.RetrieveChildren(formId);


                // Delete the form and its configurations.
                foreach (var item in configs)
                {
                    ConFormPersistence.Delete(item.Id);
                }

                Persistence.Delete(formId);


                // Success.
                result = new
                {
                    Success = true
                };
            }
            catch (Exception ex)
            {
                // Error.
                Logger.Error <FormsController>(ex, DeleteFormError);
                result = new
                {
                    Success = false,
                    Reason  = UnhandledError
                };
            }


            // Return the result.
            return(result);
        }
Ejemplo n.º 5
0
        public ActionResult DeleteForm(string formIDs)
        {
            if (!formIDs.IsAny())
            {
                return(Json(new
                {
                    success = true,
                    response = "[|Could not delete the form|]."
                }, JsonRequestBehavior.AllowGet));
            }
            DeleteFormRequest request = JsonConvert.DeserializeObject <DeleteFormRequest>(formIDs);

            formService.DeleteForm(request);
            return(Json(new
            {
                success = true,
                response = ""
            }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 6
0
        public object DeleteForm(DeleteFormRequest request)
        {
            // Variables.
            var result = default(object);

            // Catch all errors.
            try
            {

                // Variables.
                var formId = GuidHelper.GetGuid(request.FormId);
                var configs = ConFormPersistence.RetrieveChildren(formId);

                // Delete the form and its configurations.
                configs.ForEach(x => ConFormPersistence.Delete(x.Id));
                Persistence.Delete(formId);

                // Success.
                result = new
                {
                    Success = true
                };

            }
            catch (Exception ex)
            {

                // Error.
                LogHelper.Error<FormsController>(DeleteFormError, ex);
                result = new
                {
                    Success = false,
                    Reason = UnhandledError
                };

            }

            // Return the result.
            return result;
        }
Ejemplo n.º 7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public BaseResponse Any(DeleteFormRequest request)
 {
     Db.Delete <Form>(request.Id);
     return(new  BaseResponse());
 }
Ejemplo n.º 8
0
        public object DeleteForm(DeleteFormRequest request)
        {

            // Variables.
            var result = default(object);


            // Catch all errors.
            try
            {

                // Variables.
                var formId = GuidHelper.GetGuid(request.FormId);


                // Delete the form.
                Persistence.Delete(formId);


                // Success.
                result = new
                {
                    Success = true
                };

            }
            catch (Exception ex)
            {

                // Error.
                LogHelper.Error<FormsController>(DeleteFormError, ex);
                result = new
                {
                    Success = false,
                    Reason = UnhandledError
                };

            }


            // Return the result.
            return result;

        }