public async Task DeleteForAdmin(int id) { DIBZ.Common.Model.MyQueries queryLog = null; queryLog = await GetQueriesById(id); queryLog.IsDeletedByAdmin = true; await Db.SaveAsync(); }
//save Contact us form data for Application User public int SaveMessages(string adminEmailAddress, string name, string phone, string subject, string message, int?appuserid) { DIBZ.Common.Model.MyQueries myQuery = new DIBZ.Common.Model.MyQueries(); myQuery.AppUserId = appuserid; myQuery.Email = adminEmailAddress; myQuery.Name = name; myQuery.PhoneNo = phone; myQuery.Subject = subject; myQuery.Message = message; myQuery.QueryStatus = QueryStatus.Open; myQuery.IsActive = true; DIBZ.Common.Model.MyQueryDetails myQueryDetails = new DIBZ.Common.Model.MyQueryDetails(); myQueryDetails.Message = message; myQueryDetails.myquery = myQuery; Db.Add(myQueryDetails); return(Db.Save()); }
public async Task <ActionResult> SendContactRequest(FormCollection form) { DIBZ.Common.Model.MyQueries myQuery = new DIBZ.Common.Model.MyQueries(); DIBZ.Common.Model.EmailTemplate emailTemplate = new DIBZ.Common.Model.EmailTemplate(); EmailTemplateHelper templates = new EmailTemplateHelper(); EmailTemplateResponse EmailTemplateResponce = new EmailTemplateResponse(); DIBZ.Common.Model.EmailNotification email = new DIBZ.Common.Model.EmailNotification(); string adminEmail = string.Empty; string userEmail = form["email"]; string name = form["name"]; string phone = form["phone"]; string subject = "Contact Us Form - " + form["subject"]; string message = form["message"]; var authLogic = LogicContext.Create <AuthLogic>(); var suportQuery = LogicContext.Create <SupportQueryLogic>(); var emailTemplateLogic = LogicContext.Create <EmailTemplateLogic>(); if (userEmail == null) { suportQuery.SaveMessages(CurrentLoginSession.ApplicationUser.Email, name, phone, subject, message, CurrentLoginSession.ApplicationUser.Id); userEmail = System.Configuration.ConfigurationManager.AppSettings["AdminEmailAddress"]; await emailTemplateLogic.SaveEmailNotification(userEmail, subject, message, EmailType.Email, Priority.Low); //EmailHelper.Email(userEmail, subject, message); } else { suportQuery.SaveMessages(userEmail, name, phone, subject, message, null); adminEmail = System.Configuration.ConfigurationManager.AppSettings["AdminEmailAddress"]; await emailTemplateLogic.SaveEmailNotification(adminEmail, subject, message, EmailType.Email, Priority.Low); EmailHelper.Email(adminEmail, subject, message); return(View("ContactUs", myQuery)); } return(RedirectToAction("MyQueriesIndex", "MyQueries")); }