示例#1
0
        public async Task GivenId_WhenDelete_ThenDeleteSuccessful()
        {
            //?Given
            var id = "1234";

            _mockRepository.Setup(x => x.Delete(id))
            .Verifiable();

            //?When
            await _surveyManager.Delete(id);

            //?Then
            _mockRepository.Verify();
        }
示例#2
0
        public static bool Delete(string surveyId)
        {
            bool flag = false;

            if (!string.IsNullOrEmpty(surveyId) && DataValidator.IsValidId(surveyId))
            {
                flag = dal.Delete(surveyId);
                if (!flag)
                {
                    return(flag);
                }
                SurveyVote.Delete(surveyId);
                foreach (string str in surveyId.Split(new char[] { ',' }))
                {
                    SurveyRecord.DeleteTable(DataConverter.CLng(str));
                }
            }
            return(flag);
        }
        public async Task <IActionResult> Delete([FromBody] Surveys inputModel)
        {
            try
            {
                var data = await _surveysManager.Find_By_Id(inputModel.Id);

                if (data == null)
                {
                    throw new Exception($"{MessageConst.DATA_NOT_FOUND}");
                }
                await _surveysManager.Delete(inputModel.Id);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }
示例#4
0
        public async Task <ActionResult> Delete(string id)
        {
            await _surveyManager.Delete(id);

            return(Ok());
        }