Exemple #1
0
        public async Task <OperationResult> Delete(int id)
        {
            try
            {
                var core = await _coreHelper.GetCore();

                await using var dbContext = core.DbContextHelper.GetDbContext();
                List <CheckListSite> checkListSites = await dbContext.CheckListSites.Where(x => x.CheckListId == id).ToListAsync();

                foreach (var checkListSite in checkListSites)
                {
                    await core.CaseDelete(checkListSite.MicrotingUid);
                }

                CheckList checkList = await dbContext.CheckLists.SingleAsync(x => x.Id == id);

                await checkList.Delete(dbContext);

                var eformReport = _dbContext.EformReports
                                  .FirstOrDefault(x => x.TemplateId == id);

                if (eformReport != null)
                {
                    _dbContext.EformReports.Remove(eformReport);
                    await _dbContext.SaveChangesAsync();
                }

                return(new OperationResult(true,
                                           _localizationService.GetStringWithFormat("eFormParamDeletedSuccessfully", id)));
            }
            catch (Exception)
            {
                return(new OperationResult(false, _localizationService.GetStringWithFormat("eFormParamCouldNotBeDeleted", id)));
            }
        }
Exemple #2
0
        public ActionResult Delete(int ChecklistID)
        {
            CheckList CheckLists = new CheckList("Delete");



            DialogResult dr = MessageBox.Show("Are you sure to delete row?", "Confirmation", MessageBoxButtons.YesNo);

            if (dr == DialogResult.Yes)
            {
                CheckLists.Delete(ChecklistID);
                return(RedirectToAction("GetCheckList"));
            }
            else if (dr == DialogResult.No)
            {
            }


            return(RedirectToAction("GetCheckList"));
        }