Exemplo n.º 1
0
        /// <summary>
        /// send user a complaint read notification via mail
        /// </summary>
        public bool SendMail_UserComplaintRead(UserComplaint complaint)
        {
            if (complaint.User == null) return false;

            //user information
            var fullName = string.Format("{0} {1}", complaint.User.FirstName, complaint.User.LastName);
            var userEmail = complaint.User.Email;

            //building message
            const string subject = "update from gaz company";
            var body =
            string.Format("<table><tr><td>hi {0},</td></tr><tr><td>your complaint (#{1}) is being addressed.</td></tr></table>", fullName, complaint.ID);

            //sending message
            return this.SendMail(this.IMPERSONATION_MAIL_FROM, subject, body, userEmail);
        }
Exemplo n.º 2
0
        public ActionResult SubmitComplaint(string desc, int counterId)
        {
            desc = desc.Trim();

            var userId = GetUserIdFromUserName(User.Identity.Name);

            using (var db = new GazDbContext())
            {
                var complaint = new UserComplaint
                {
                    ComplaintDescription = desc,
                    CounterID = counterId,
                    Disable = false,
                    CreateTime = DateTime.Now,
                    UserID = userId
                };

                db.UserComplaints.Add(complaint);
                db.SaveChanges();
            }

            return null;
        }