public TenantEmailTemplates CreateEmailEmailTemplate(TenantEmailTemplates template) { var emailTemplate = new TenantEmailTemplates() { HtmlHeader = template.HtmlHeader, EventName = template.EventName, Body = template.Body, HtmlFooter = template.HtmlFooter, DateCreated = DateTime.UtcNow, CreatedBy = template.CreatedBy, NotificationType = template.NotificationType, TenantId = template.TenantId, }; _currentDbContext.Entry(emailTemplate).State = EntityState.Added; _currentDbContext.SaveChanges(); return(emailTemplate); }
public ActionResult Edit(TenantEmailTemplates emailtemp) { if (!caSession.AuthoriseSession()) { return(Redirect((string)Session["ErrorUrl"])); } if (ModelState.IsValid) { emailtemp.TenantId = CurrentTenantId; emailtemp.UpdatedBy = CurrentUserId; emailtemp.DateUpdated = DateTime.UtcNow; _emailNotificationService.SaveEmailEmailTemplate(emailtemp); return(RedirectToAction("Index")); } return(View(emailtemp)); }
public ActionResult Create(TenantEmailTemplates template) { if (!caSession.AuthoriseSession()) { return(Redirect((string)Session["ErrorUrl"])); } if (ModelState.IsValid) { template.TenantId = CurrentTenantId; template.CreatedBy = CurrentUserId; template.DateCreated = DateTime.UtcNow; _emailNotificationService.CreateEmailEmailTemplate(template); return(RedirectToAction("Index")); } ViewBag.InventoryTransactionTypeId = new SelectList(LookupServices.GetAllInventoryTransactionTypes(), "InventoryTransactionTypeId", "OrderType", LookupServices.GetAllInventoryTransactionTypes().Select(x => x.OrderType).FirstOrDefault()); return(View(template)); }
public TenantEmailTemplates SaveEmailEmailTemplate(TenantEmailTemplates newTemplate) { var template = _currentDbContext.TenantEmailTemplates.Find(newTemplate.TemplateId); if (template != null) { template.HtmlHeader = newTemplate.HtmlHeader; template.Body = newTemplate.Body; template.HtmlFooter = newTemplate.HtmlFooter; template.NotificationType = newTemplate.NotificationType; template.EventName = newTemplate.EventName; template.DateUpdated = DateTime.UtcNow; template.UpdatedBy = newTemplate.UpdatedBy; template.TenantId = newTemplate.TenantId; _currentDbContext.Entry(template).State = EntityState.Modified; _currentDbContext.SaveChanges(); } return(template); }