示例#1
0
        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);
            }
        }
示例#2
0
        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()));
            }
        }
示例#3
0
        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);
        }