示例#1
0
        public ActionResult <DeleteSiteResponseModel> DeleteSite([FromBody] DeleteSiteInputModel data)
        {
            DeleteSiteResponseModel res = new DeleteSiteResponseModel();

            try
            {
                SiteRepository repo = new SiteRepository(DbContext);
                var            tes  = repo.Delete(data.SiteID, data.UserID);

                DeleteSiteOutputModel output = new DeleteSiteOutputModel();
                output.message = tes.Message;

                res.data     = output;
                res.Message  = "Success";
                res.Response = true;

                return(Ok(res));
            }
            catch (Exception ex)
            {
                res.Message  = ex.Message;
                res.Response = false;

                return(BadRequest(res));
            }
        }
示例#2
0
        //public ActionResult EditCompleted(string[] headlines)
        //public ActionResult EditCompleted()
        //{
        //    return RedirectToAction("Index");
        //    //return View("News", new ViewStringModel
        //    //{
        //    //    NewsHeadlines = headlines
        //    //});
        //}

        //
        // GET: /Site/Delete/5

        public ActionResult Delete(int id)
        {
            //repo.DeletePhoto(id);
            repo.Delete(id);
            return(RedirectToAction("Index"));

            //return View();
        }
示例#3
0
        public void Delete(int id)
        {
            var repository = new SiteRepository(_dbContext, _cache.Object, _logger.Object);

            repository.Delete(id);

            var testedItem = _dbContext.Sites.Find(id);

            Assert.Null(testedItem);
        }
示例#4
0
 public ActionResult <string> Delete(int id)
 {
     try
     {
         return(Ok(_repo.Delete(id)));
     }
     catch (Exception e)
     {
         return(BadRequest(e));
     }
 }
示例#5
0
        public static MessageResult SimpleRemove(int id)
        {
            var site = SiteRepository.GetById(id);

            if (site == null)
            {
                throw new Exception(string.Format(SiteStrings.SiteNotFound, id));
            }

            if (site.LockedByAnyoneElse)
            {
                return(MessageResult.Error(string.Format(SiteStrings.LockedByAnyoneElse, site.LockedByDisplayName)));
            }

            SiteRepository.Delete(id);
            return(null);
        }
示例#6
0
        public MultistepActionStepResult Step(int step)
        {
            var site = SiteRepository.GetById(SiteId);

            if (site == null)
            {
                throw new ApplicationException(string.Format(SiteStrings.SiteNotFound, SiteId));
            }
            if (site.LockedByAnyoneElse)
            {
                throw new ApplicationException(string.Format(SiteStrings.LockedByAnyoneElse, site.LockedByDisplayName));
            }

            SiteRepository.Delete(SiteId);
            return(new MultistepActionStepResult {
                ProcessedItemsCount = 1
            });
        }
示例#7
0
        public async Task <IActionResult> Delete(int id)
        {
            ResponseHelper objHelper = new ResponseHelper();

            try
            {
                await SiteRepository.Delete(id);

                objHelper.Status  = StatusCodes.Status200OK;
                objHelper.Message = "Saved Successfully";
                return(Ok(objHelper));
            }
            catch
            {
                objHelper.Status  = StatusCodes.Status500InternalServerError;
                objHelper.Message = "Save Unsuccessful";
                return(StatusCode(StatusCodes.Status500InternalServerError, objHelper));
            }
        }
示例#8
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult messageBoxResult = MessageBox.Show("Are you sure to permanently delete this site checker?", "Are you sure?", MessageBoxButton.OKCancel);

            if (messageBoxResult == MessageBoxResult.OK)
            {
                using (var session = SharpArch.NHibernate.NHibernateSession.GetDefaultSessionFactory().OpenSession())
                {
                    using (var transaction = session.BeginTransaction())
                    {
                        SiteRepository siteRepository = new SiteRepository(session);
                        Site           siteToDelete   = ((FrameworkElement)sender).DataContext as Site;
                        int            id             = siteToDelete.Id;
                        Site           site           = siteRepository.Get(id);
                        siteRepository.Delete(site);
                        transaction.Commit();
                    }
                }

                UpdateDataGrid();
            }
        }
示例#9
0
 public void DeleteSite(int id)
 {
     _siteRepository.Delete(id);
 }