// Post: Admin/EmailTemplateC/Delete/id public virtual ActionResult Delete(int id) { EmailTemplate emailTemplate = _emailTemplateService.Find(id); if (emailTemplate == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } _emailTemplateService.Remove(id); _uow.SaveAllChanges(); return(Json(new { success = true })); }
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)); } }