Ejemplo n.º 1
0
        public IActionResult DeleteEmailTemplate(int id)
        {
            var emailTemplate = id > 0 ? _emailTemplateService.Get(id) : null;

            if (emailTemplate == null)
            {
                return(NotFound());
            }

            if (emailTemplate.IsSystem)
            {
                return(R.Fail.With("error", T("A system template can't be deleted")).Result);
            }
            _emailTemplateService.Delete(emailTemplate);
            return(R.Success.Result);
        }
Ejemplo n.º 2
0
        public IHttpActionResult Delete(int id)
        {
            //get the account
            var emailTemplate = _emailTemplateService.Get(id);

            if (emailTemplate == null)
            {
                return(NotFound());
            }

            if (emailTemplate.IsSystem)
            {
                return(RespondFailure("Can't delete a system template", "delete_emailtemplate"));
            }
            //delete the account
            _emailTemplateService.Delete(emailTemplate);

            return(RespondSuccess());
        }
Ejemplo n.º 3
0
        public IActionResult Delete(int id)
        {
            if (id <= 0)
            {
                return(BadRequest());
            }

            var emailTemplate = _emailTemplateService.FirstOrDefault(x => x.Id == id);

            //if (emailTemplate.IsSystem)
            //{
            //    ErrorNotification("Can't delete a system template");
            //    return RespondFailure();
            //}
            _emailTemplateService.Delete(emailTemplate);

            VerboseReporter.ReportSuccess("Xóa EmailMessage thành công", "delete");
            return(RespondSuccess());
        }
        public IHttpActionResult Deleteemail_template(int email_templateId)
        {
            ResponseDataDTO <email_template> response = new ResponseDataDTO <email_template>();

            try
            {
                var email_templateDeleted = _email_templateservice.Find(email_templateId);
                if (email_templateDeleted != null)
                {
                    _email_templateservice.Delete(email_templateDeleted);

                    // return response
                    response.Code    = HttpCode.OK;
                    response.Message = MessageResponse.SUCCESS;
                    response.Data    = null;
                    return(Ok(response));
                }
                else
                {
                    // return response
                    response.Code    = HttpCode.NOT_FOUND;
                    response.Message = MessageResponse.FAIL;
                    response.Data    = null;

                    return(Ok(response));
                }
            }
            catch (Exception ex)
            {
                response.Code    = HttpCode.INTERNAL_SERVER_ERROR;
                response.Message = ex.Message;
                response.Data    = null;
                Console.WriteLine(ex.ToString());

                return(Ok(response));
            }
        }
        public async Task <BaseResult> Delete(long id)
        {
            var result = await _emailTemplateService.Delete(id);

            return(result);
        }