Exemplo n.º 1
0
        public ActionResult Draft([Bind(Include = "Id,FromEmail,Receiver,ReadReceiptTo,Subject,Body,Created,CreatedBy,Sent")] BroadcastingEmail broadcastingEmail)
        {
            if (ModelState.IsValid)
            {
                broadcastingEmail.Body      = HttpUtility.HtmlDecode(broadcastingEmail.Body);
                broadcastingEmail.Created   = DateTime.Now;
                broadcastingEmail.CreatedBy = System.Web.HttpContext.Current.User.Identity.Name.ToString();
                broadcastingEmail.Sent      = false;

                if (broadcastingEmail.Id > 0)
                {
                    db.Entry(broadcastingEmail).State = EntityState.Modified;
                    db.SaveChanges();
                }
                else
                {
                    db.BroadcastingEmails.Add(broadcastingEmail);
                    db.SaveChanges();
                }
                return(RedirectToAction("Index"));
            }
            else
            {
                var errors = ModelState.Where(x => x.Value.Errors.Any())
                             .Select(x => new { x.Key, x.Value.Errors });
            }

            return(View(broadcastingEmail));
        }
 public ActionResult Edit([Bind(Include = "ID,Name,Email")] FromEmail fromEmail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(fromEmail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(fromEmail));
 }
Exemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "Id,Name,Roles")] User user)
 {
     user.Roles = Request.Form["Roles"];
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(user));
 }
 public ActionResult Edit([Bind(Include = "ID,Name,Html,CreatedBy,FromEmail,Receiver,Subject")] Template template)
 {
     if (ModelState.IsValid)
     {
         template.CreatedBy       = System.Web.HttpContext.Current.User.Identity.Name.ToString();
         template.Created         = DateTime.Now;
         db.Entry(template).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(template));
 }
Exemplo n.º 5
0
 public void UpdateLoginTime(AccountUser user)
 {
     user.LoginTime = DateTime.Now;
     _db.Entry <AccountUser>(user).State = System.Data.Entity.EntityState.Modified;
     _db.SaveChanges();
 }