public JsonResult Delete(IdeaModel model) { try { #region " [ Declaration ] " IdeaService _service = new IdeaService(); #endregion #region " [ Main process ] " model.CreateBy = UserID; model.DeleteBy = UserID; model.DeleteDate = DateTime.Now; #endregion //Call to service return(this.Json(_service.Delete(model), JsonRequestBehavior.AllowGet)); } catch (ServiceException serviceEx) { throw serviceEx; } catch (DataAccessException accessEx) { throw accessEx; } catch (Exception ex) { throw new ControllerException(FILE_NAME, "Delete", UserID, ex); } }
private void DeleteButton_Click(object sender, System.EventArgs e) { var selectedIdeas = ((ListView)GetIdeaList(_area)).CheckedItems; foreach (ListViewItem idea in selectedIdeas) { idea.Remove(); _ideaService.Delete(int.Parse(idea.Name.Trim())); } }
public void Repository_is_called_when_deleting_an_idea() { //Arrange const int id = 1; var repository = Substitute.For <IIdeaRepository>(); IIdeaService service = new IdeaService(repository); //Act service.Delete(id); //Assert repository.Received().Delete(id); }