public void SendComplaintReadMail() { bool isSent = false; using (var db = new GazDbContext()) { var repo = new UserComplaintsRepository(db); var result = repo.GetByID(1005); if (result != null) { result.Disable = true; try { repo.Commit(); using (var ms = new MailingService()) { isSent = ms.SendMail_UserComplaintRead(result); } } catch (Exception) { throw; } } } Assert.IsTrue(isSent); }
public ActionResult ComplaintUpdate([DataSourceRequest] DataSourceRequest request, ComplaintModel comp) { if (ModelState.IsValid) { using (var db = new GazDbContext()) { var repo = new UserComplaintsRepository(db); var result = repo.GetByID(comp.ComplaintID); if (result != null) { result.Disable = comp.Disable; try { repo.Commit(); using (var ms = new MailingService()) { ms.SendMail_UserComplaintRead(result); } } catch (Exception) { return Json(new[] { comp }.ToDataSourceResult(request, ModelState)); } } } } return Json(new[] { comp }.ToDataSourceResult(request, ModelState)); }