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)); } }
//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(); }
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); }
public ActionResult <string> Delete(int id) { try { return(Ok(_repo.Delete(id))); } catch (Exception e) { return(BadRequest(e)); } }
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); }
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 }); }
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)); } }
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(); } }
public void DeleteSite(int id) { _siteRepository.Delete(id); }