Ejemplo n.º 1
0
        public static int SendMailByOrderDetail(int?ItemID)
        {
            int id = 0;

            using (var context = new EgreetingContext())
            {
                var orderDetail = context.OrderDetails.Find(ItemID);
                id = orderDetail.OrderDetailID;

                MailMessage mail       = new MailMessage();
                SmtpClient  SmtpServer = new SmtpClient("smtp.gmail.com");

                Attachment data = new Attachment(HostingEnvironment.ApplicationPhysicalPath + "Uploads/EcardFiles/" + orderDetail.Ecard.EcardUrl);
                mail.Attachments.Add(data);


                mail.From = new MailAddress(WebConfigurationManager.AppSettings["EmailSender"]);
                mail.To.Add(orderDetail.Order.RecipientEmail);
                mail.Subject = orderDetail.Order.SendSubject + " - " + orderDetail.Order.SenderName;
                mail.Body    = orderDetail.Order.SendMessage;

                SmtpServer.Port        = 587;
                SmtpServer.Credentials = new System.Net.NetworkCredential(WebConfigurationManager.AppSettings["EmailSender"], WebConfigurationManager.AppSettings["PasswordEmail"]);
                SmtpServer.EnableSsl   = true;

                try
                {
                    SmtpServer.Send(mail);
                    orderDetail.SendStatus = true;
                    orderDetail.SendTime   = DateTime.Now;
                    context.OrderDetails.Attach(orderDetail);
                    context.Entry(orderDetail).State = EntityState.Modified;
                    context.SaveChanges();
                    var order = context.Set <Order>().Find(orderDetail.Order.OrderID);
                    if (!order.OrderDetails.Any(x => !x.SendStatus))
                    {
                        order.SendStatus = true;
                    }
                    context.Orders.Attach(order);
                    context.Entry(order).State = EntityState.Modified;
                    context.SaveChanges();
                }
                catch (Exception)
                {
                }
            }
            using (var db = new EgreetingContext())
            {
                var abc = db.OrderDetails.Find(id);
            }
            return(1);
        }
        public IHttpActionResult PutOrderDetail(int id, OrderDetail OrderDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != OrderDetail.OrderDetailID)
            {
                return(BadRequest());
            }

            db.Entry(OrderDetail).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!OrderDetailExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 3
0
 public async Task <IHttpActionResult> Put([FromODataUri] int key, Ecard update)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     if (key != update.EcardID)
     {
         return(BadRequest());
     }
     db.Entry(update).State = EntityState.Modified;
     try
     {
         await db.SaveChangesAsync();
     }
     catch (DbUpdateConcurrencyException)
     {
         if (!EcardExists(key))
         {
             return(NotFound());
         }
         else
         {
             throw;
         }
     }
     return(Updated(update));
 }
Ejemplo n.º 4
0
        public IHttpActionResult PutSubcriber(int id, Subcriber subcriber)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != subcriber.SubcriberID)
            {
                return(BadRequest());
            }

            db.Entry(subcriber).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SubcriberExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 5
0
        public IHttpActionResult PutEcard(int id, Ecard ecard)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != ecard.EcardID)
            {
                return(BadRequest());
            }

            db.Entry(ecard).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EcardExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 6
0
        public IHttpActionResult PutFeedback(int id, Feedback feedback)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != feedback.FeedbackID)
            {
                return(BadRequest());
            }

            db.Entry(feedback).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FeedbackExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 7
0
        public ActionResult Edit([Bind(Include = "PaymentID,Month,Year,PaymentStatus")] Payment Payment, int?EgreetingUserID)
        {
            if (ModelState.IsValid)
            {
                using (var context = new EgreetingContext())
                {
                    var paymentUpdate = context.Set <Payment>().Find(Payment.PaymentID);
                    if (EgreetingUserID != null && paymentUpdate.EgreetingUser.EgreetingUserID != EgreetingUserID)
                    {
                        var egreetingUser = context.Set <EgreetingUser>().Find(EgreetingUserID);

                        if (egreetingUser != null)
                        {
                            paymentUpdate.EgreetingUser = egreetingUser;
                        }
                    }
                    paymentUpdate.Month         = Payment.Month;
                    paymentUpdate.Year          = Payment.Year;
                    paymentUpdate.PaymentStatus = Payment.PaymentStatus;
                    paymentUpdate.ModifiedDate  = DateTime.Now;
                    context.Set <Payment>().Attach(paymentUpdate);
                    context.Entry(paymentUpdate).State = EntityState.Modified;
                    context.SaveChanges();
                }
                return(RedirectToAction("Index"));
            }
            ViewBag.EgreetingUsers = EgreetingUserBusiness.AllNoTracking.Where(x => x.Draft != true).Select(x => new { x.EgreetingUserID, x.Email }).ToDictionary(k => k.EgreetingUserID, v => v.Email);
            return(View(ViewNamesConstant.AdminPaymentsEdit, Payment));
        }
Ejemplo n.º 8
0
        public ActionResult Edit([Bind(Include = "ScheduleSenderID,ScheduleTime,ScheduleType,SenderName,RecipientEmail,SendSubject,SendMessage")] ScheduleSender ScheduleSender, int?EcardID, int?EgreetingUserID)
        {
            if (ModelState.IsValid)
            {
                using (var context = new EgreetingContext())
                {
                    var scheduleSenderUpdate = context.Set <ScheduleSender>().Find(ScheduleSender.ScheduleSenderID);
                    // thinh: check user exist
                    if (EcardID != null)
                    {
                        var egreetingUser = context.Set <EgreetingUser>().Find(EgreetingUserID);
                        if (egreetingUser == null)
                        {
                            ModelState.AddModelError(string.Empty, "User not found!");
                            ViewBag.Ecards         = EcardBusiness.AllNoTracking.Where(x => x.Draft != true).Select(x => new { x.EcardID, x.EcardName }).ToDictionary(k => k.EcardID, v => v.EcardName);
                            ViewBag.EgreetingUsers = EgreetingUserBusiness.AllNoTracking.Where(x => x.Draft != true).Select(x => new { x.EgreetingUserID, x.Email }).ToDictionary(k => k.EgreetingUserID, v => v.Email);
                            return(View(ViewNamesConstant.AdminScheduleSendersCreate, ScheduleSender));
                        }
                        scheduleSenderUpdate.EgreetingUser = egreetingUser;
                    }

                    // thinh: check ecard exist
                    if (EcardID != null)
                    {
                        var ecard = context.Set <Ecard>().Find(EcardID);
                        if (ecard == null)
                        {
                            ModelState.AddModelError(string.Empty, "Ecard not found!");
                            ViewBag.Ecards         = EcardBusiness.AllNoTracking.Where(x => x.Draft != true).Select(x => new { x.EcardID, x.EcardName }).ToDictionary(k => k.EcardID, v => v.EcardName);
                            ViewBag.EgreetingUsers = EgreetingUserBusiness.AllNoTracking.Where(x => x.Draft != true).Select(x => new { x.EgreetingUserID, x.Email }).ToDictionary(k => k.EgreetingUserID, v => v.Email);
                            return(View(ViewNamesConstant.AdminScheduleSendersCreate, ScheduleSender));
                        }
                        scheduleSenderUpdate.Ecard = ecard;
                    }

                    // thinh: create schedule sender
                    scheduleSenderUpdate.ScheduleTime   = ScheduleSender.ScheduleTime;
                    scheduleSenderUpdate.ScheduleType   = ScheduleSender.ScheduleType;
                    scheduleSenderUpdate.SenderName     = ScheduleSender.SenderName;
                    scheduleSenderUpdate.RecipientEmail = ScheduleSender.RecipientEmail;
                    scheduleSenderUpdate.SendSubject    = ScheduleSender.SendSubject;
                    scheduleSenderUpdate.SendMessage    = ScheduleSender.SendMessage;
                    scheduleSenderUpdate.ModifiedDate   = DateTime.Now;

                    context.Set <ScheduleSender>().Attach(scheduleSenderUpdate);
                    context.Entry(scheduleSenderUpdate).State = EntityState.Modified;
                    context.SaveChanges();
                }
                return(RedirectToAction("Index"));
            }
            ViewBag.Ecards         = EcardBusiness.AllNoTracking.Where(x => x.Draft != true).Select(x => new { x.EcardID, x.EcardName }).ToDictionary(k => k.EcardID, v => v.EcardName);
            ViewBag.EgreetingUsers = EgreetingUserBusiness.AllNoTracking.Where(x => x.Draft != true).Select(x => new { x.EgreetingUserID, x.Email }).ToDictionary(k => k.EgreetingUserID, v => v.Email);
            return(View(ViewNamesConstant.AdminScheduleSendersEdit, ScheduleSender));
        }
        public ActionResult Edit([Bind(Include = "EgreetingUserSlug,FirstName,LastName,Email,Password,ConfirmPassword,BirthDay,CreditCardNumber,CreditCardCVG,PaymentDueDate")] EgreetingUser egreetingUser, string UserId, string ListRole)
        {
            var file = Request.Files["Avatar"];

            byte[] image = new byte[file.ContentLength];
            file.InputStream.Read(image, 0, image.Length);

            if (ModelState.IsValid)
            {
                var user = UserManager.FindById(UserId);
                user.EgreetingUser.EgreetingUserSlug = egreetingUser.EgreetingUserSlug;
                user.EgreetingUser.FirstName         = egreetingUser.FirstName;
                user.EgreetingUser.LastName          = egreetingUser.LastName;
                user.EgreetingUser.BirthDay          = egreetingUser.BirthDay;
                user.EgreetingUser.CreditCardNumber  = egreetingUser.CreditCardNumber;
                user.EgreetingUser.CreditCardCVG     = egreetingUser.CreditCardCVG;
                user.EgreetingUser.PaymentDueDate    = egreetingUser.PaymentDueDate;
                if (file.ContentLength > 0)
                {
                    user.EgreetingUser.Avatar = image;
                }
                if (!string.IsNullOrEmpty(egreetingUser.Password))
                {
                    UserManager.RemovePassword(user.Id);
                    UserManager.AddPassword(user.Id, egreetingUser.Password);
                    UserManager.Update(user);
                }
                else
                {
                    UserManager.Update(user);
                }
                using (var context = new EgreetingContext())
                {
                    var lstRoleId = ListRole.Split('-').Where(x => x.Length > 0).Select(x => Convert.ToInt32(x)).ToList();
                    var eUser     = context.Set <EgreetingUser>().Where(x => x.Email.Equals(user.Email)).FirstOrDefault();
                    eUser.EgreetingRoles = context.Set <EgreetingRole>().Where(x => lstRoleId.Contains(x.EgreetingRoleID)).ToList();
                    context.Set <EgreetingUser>().Attach(eUser);
                    context.Entry(eUser).State = EntityState.Modified;
                    context.SaveChanges();
                }
                return(RedirectToAction("Index"));
            }
            ViewBag.ListRole = EgreetingRoleBusiness.All.Where(x => x.Draft != true).ToList();
            return(View(ViewNamesConstant.AdminEgreetingUsersEdit, egreetingUser));
        }
Ejemplo n.º 10
0
        public async Task <ActionResult> Create([Bind(Include = "Email")] Subcriber subcriber)
        {
            if (ModelState.IsValid)
            {
                var egreetingUser = new EgreetingUser
                {
                    CreatedDate = DateTime.Now,
                    Avatar      = System.IO.File.ReadAllBytes(Server.MapPath("~/Content/Admin/dist/img/avatar.png")),
                    Email       = subcriber.Email,
                };
                var applicationUser = new ApplicationUser {
                    Email = egreetingUser.Email, UserName = egreetingUser.Email, EgreetingUser = egreetingUser
                };
                var result = await UserManager.CreateAsync(applicationUser, "delete123456Aa");

                using (var context = new EgreetingContext())
                {
                    var roleStore   = new RoleStore <IdentityRole>(context);
                    var roleManager = new RoleManager <IdentityRole>(roleStore);
                    var userStore   = new UserStore <ApplicationUser>(context);
                    var userManager = new UserManager <ApplicationUser>(userStore);
                    userManager.AddToRole(applicationUser.Id, "Subcriber");
                }
                if (result.Succeeded)
                {
                    using (var context = new EgreetingContext())
                    {
                        var eUser = context.Set <EgreetingUser>().Where(x => x.Email.Equals(egreetingUser.Email)).FirstOrDefault();
                        eUser.EgreetingRoles    = context.Set <EgreetingRole>().Where(x => x.EgreetingRoleName.Equals("Subcriber")).ToList();
                        subcriber.EgreetingUser = eUser;
                        context.Set <Subcriber>().Attach(subcriber);
                        context.Entry(subcriber).State = EntityState.Modified;
                        context.SaveChanges();
                    }
                    return(RedirectToAction("Index"));
                }
                AddErrors(result);
            }
            return(View(ViewNamesConstant.AdminSubcribersCreate, subcriber));
        }
        public ActionResult Create([Bind(Include = "EgreetingUserSlug,FirstName,LastName,Email,Password,ConfirmPassword,BirthDay,CreditCardNumber,CreditCardCVG,PaymentDueDate")] EgreetingUser egreetingUser, string ListRole)
        {
            var file = Request.Files["Avatar"];

            byte[] image = new byte[file.ContentLength];
            file.InputStream.Read(image, 0, image.Length);

            if (file.ContentLength == 0)
            {
                image = System.IO.File.ReadAllBytes(Server.MapPath("~/Content/Admin/dist/img/avatar.png"));
            }

            if (ModelState.IsValid)
            {
                egreetingUser.CreatedDate = DateTime.Now;
                egreetingUser.Avatar      = image;
                //egreetingUser.EgreetingRoles = lstEgreetingRole;
                var applicationUser = new ApplicationUser {
                    Email = egreetingUser.Email, UserName = egreetingUser.Email, EgreetingUser = egreetingUser
                };
                var result = UserManager.Create(applicationUser, egreetingUser.Password);
                if (result.Succeeded)
                {
                    using (var context = new EgreetingContext())
                    {
                        var lstRoleId = ListRole.Split('-').Where(x => x.Length > 0).Select(x => Convert.ToInt32(x)).ToList();
                        var eUser     = context.Set <EgreetingUser>().Where(x => x.Email.Equals(egreetingUser.Email)).FirstOrDefault();
                        eUser.EgreetingRoles = context.Set <EgreetingRole>().Where(x => lstRoleId.Contains(x.EgreetingRoleID)).ToList();
                        context.Set <EgreetingUser>().Attach(eUser);
                        context.Entry(eUser).State = EntityState.Modified;
                        context.SaveChanges();
                    }
                    return(RedirectToAction("Index"));
                }
                AddErrors(result);
            }
            ViewBag.ListRole = EgreetingRoleBusiness.All.Where(x => x.Draft != true).ToList();
            return(View(ViewNamesConstant.AdminEgreetingUsersCreate, egreetingUser));
        }
Ejemplo n.º 12
0
        public void OnTimer(object sender, System.Timers.ElapsedEventArgs args)
        {
            eventLogServices.WriteEntry("Ghi log nghiệp vụ");
            // payment handle;
            using (var context = new EgreetingContext())
            {
                var currentDate              = DateTime.Now;
                var nextmonthDate            = DateTime.Now.AddMonths(1);
                var listUserID               = context.Set <Subcriber>().Where(x => x.Draft != true).Select(x => x.EgreetingUser.EgreetingUserID).ToList();
                var listUserPaymentThisMonth = context.Set <Payment>()
                                               .Where(x => x.Draft != true &&
                                                      x.Month == currentDate.Month &&
                                                      x.Year == currentDate.Year)
                                               .Select(x => x.EgreetingUser.EgreetingUserID).ToList();
                var listUserPaymentNextMonth = context.Set <Payment>()
                                               .Where(x => x.Draft != true &&
                                                      x.Month == nextmonthDate.Month &&
                                                      x.Year == nextmonthDate.Year)
                                               .Select(x => x.EgreetingUser.EgreetingUserID).ToList();
                var listUserIDThisMonth = listUserID.Where(x => !listUserPaymentThisMonth.Contains(x)).ToList();
                var listUserIDNextMonth = listUserID.Where(x => !listUserPaymentNextMonth.Contains(x)).ToList();

                var payments = new List <Payment>();
                foreach (var itemID in listUserIDThisMonth)
                {
                    var payment = new Payment
                    {
                        Month         = currentDate.Month,
                        Year          = currentDate.Year,
                        PaymentStatus = false,
                        EgreetingUser = context.Set <EgreetingUser>().Find(itemID),
                        CreatedDate   = DateTime.Now,
                    };
                    payments.Add(payment);
                }
                foreach (var itemID in listUserIDNextMonth)
                {
                    var payment = new Payment
                    {
                        Month         = nextmonthDate.Month,
                        Year          = nextmonthDate.Year,
                        PaymentStatus = false,
                        EgreetingUser = context.Set <EgreetingUser>().Find(itemID),
                        CreatedDate   = DateTime.Now,
                    };
                    payments.Add(payment);
                }
                context.Set <Payment>().AddRange(payments);
                context.SaveChanges();
            }

            // sendmail handle;
            using (var context = new EgreetingContext())
            {
                var listOrderUpdate = context.Orders.Where(x => x.Draft != true && x.SendStatus == false && x.ScheduleTime <= DateTime.Now).ToList();
                foreach (var item in listOrderUpdate)
                {
                    item.SendStatus   = true;
                    item.ModifiedDate = DateTime.Now;
                    foreach (var detail in item.OrderDetails)
                    {
                        detail.SendStatus   = true;
                        detail.SendTime     = DateTime.Now;
                        detail.ModifiedDate = DateTime.Now;
                    }
                    context.Orders.Attach(item);
                    context.Entry(item).State = System.Data.Entity.EntityState.Modified;
                    context.SaveChanges();
                }
            }
        }
Ejemplo n.º 13
0
 public void Update(T entityToUpdate)
 {
     DbSet.Attach(entityToUpdate);
     Context.Entry(entityToUpdate).State = EntityState.Modified;
 }
Ejemplo n.º 14
0
        public ActionResult Edit([Bind(Include = "EcardID,EcardName,EcardSlug,EcardType,Price")] Ecard ecard)
        {
            if (ModelState.IsValid)
            {
                using (var context = new EgreetingContext())
                {
                    var ecardUpdate = context.Set <Ecard>().Find(ecard.EcardID);

                    var    thumbnailFile  = Request.Files["Thumbnail"];
                    var    ecardFile      = Request.Files["EcardFile"];
                    string pathThumbnail  = Server.MapPath("~/Uploads/Thumbnails/");
                    string pathEcardFiles = Server.MapPath("~/Uploads/EcardFiles/");
                    if (!Directory.Exists(pathEcardFiles))
                    {
                        Directory.CreateDirectory(pathEcardFiles);
                        if (!Directory.Exists(pathThumbnail))
                        {
                            Directory.CreateDirectory(pathThumbnail);
                        }
                    }

                    if (ecardFile != null)
                    {
                        if (!Path.GetExtension(ecardFile.FileName).CheckExtentionFile(ecard.EcardType))
                        {
                            ModelState.AddModelError(string.Empty, "File upload not support!");
                            ViewBag.Categories = CategoryBusiness.All.ToList();
                            return(View(ViewNamesConstant.AdminEcardsCreate, ecard));
                        }
                        ecard.EcardUrl = "EcardUrl_" + DateTime.Now.ToFileTime() + Path.GetExtension(ecardFile.FileName);
                        ecardFile.SaveAs(pathEcardFiles + ecard.EcardUrl);

                        if (thumbnailFile != null && Path.GetExtension(thumbnailFile.FileName).CheckExtentionFile())
                        {
                            ecard.ThumbnailUrl = "Thumbnail_" + DateTime.Now.ToFileTime() + Path.GetExtension(thumbnailFile.FileName);
                            thumbnailFile.SaveAs(pathThumbnail + ecard.ThumbnailUrl);
                        }
                        else
                        {
                            ecard.ThumbnailUrl = "thumbnail.png";
                        }
                    }

                    ecardUpdate.EcardName = ecard.EcardName;
                    if (!string.IsNullOrEmpty(ecard.EcardSlug))
                    {
                        if (!context.Set <Ecard>().Any(x => ecard.EcardSlug.Equals(x.EcardSlug)))
                        {
                            ecardUpdate.EcardSlug = ecard.EcardSlug;
                        }
                        else
                        {
                            ecardUpdate.EcardSlug = ecard.EcardSlug + DateTime.Now.ToFileTime();
                        }
                    }
                    ecardUpdate.EcardType    = ecard.EcardType;
                    ecardUpdate.Price        = ecard.Price;
                    ecardUpdate.ModifiedDate = DateTime.Now;

                    context.Set <Ecard>().Attach(ecardUpdate);
                    context.Entry(ecardUpdate).State = EntityState.Modified;
                    context.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }
            ViewBag.Categories = CategoryBusiness.All.ToList();
            return(View(ViewNamesConstant.AdminEcardsEdit, ecard));
        }
Ejemplo n.º 15
0
        public ActionResult Edit([Bind(Include = "OrderID,SenderName,RecipientEmail,SendSubject,SendStatus,SendMessage,ScheduleTime")] Order Order, string ListEcardString)
        {
            if (string.IsNullOrEmpty(Order.RecipientEmail))
            {
                ModelState.AddModelError("RecipientEmail", "Recipient's email can't not be empty!");
            }
            if (ModelState.IsValid)
            {
                using (var context = new EgreetingContext())
                {
                    var orderUpdate = context.Set <Order>().Find(Order.OrderID);


                    if (orderUpdate == null)
                    {
                        ViewBag.Ecards = EcardBusiness.AllNoTracking.Where(x => x.Draft != true).ToList();
                        ModelState.AddModelError(string.Empty, "Order not found!");
                        return(View(ViewNamesConstant.AdminOrdersEdit, Order));
                    }

                    // thinh: check sending status
                    if (orderUpdate.SendStatus == true || orderUpdate.OrderDetails.Any(x => x.Draft != true && x.SendStatus))
                    {
                        ViewBag.Ecards = EcardBusiness.AllNoTracking.Where(x => x.Draft != true).ToList();
                        ModelState.AddModelError(string.Empty, "Can't edit because ecard had been sended!");
                        return(View(ViewNamesConstant.AdminOrdersEdit, Order));
                    }

                    // thinh: remove order detail
                    foreach (var orderDetailRemove in orderUpdate.OrderDetails)
                    {
                        orderDetailRemove.Draft = true;
                    }

                    // thinh: update order detail
                    var listEcardID      = ListEcardString.Split('-').Where(x => x.Length > 0).Select(x => Convert.ToInt32(x)).ToList();
                    var listOrderDetails = new List <OrderDetail>();
                    foreach (var ecardID in listEcardID)
                    {
                        var ecard        = context.Set <Ecard>().Find(ecardID);
                        var orderDetails = new OrderDetail
                        {
                            SendStatus  = Order.SendStatus,
                            Ecard       = ecard,
                            CreatedDate = DateTime.Now,
                        };
                        listOrderDetails.Add(orderDetails);
                    }
                    orderUpdate.OrderDetails = listOrderDetails;

                    // thinh: update order
                    orderUpdate.SendSubject    = Order.SendSubject;
                    orderUpdate.SendStatus     = Order.SendStatus;
                    orderUpdate.SenderName     = Order.SenderName;
                    orderUpdate.RecipientEmail = Order.RecipientEmail;
                    orderUpdate.SendMessage    = Order.SendMessage;
                    orderUpdate.ScheduleTime   = Order.ScheduleTime;
                    orderUpdate.ModifiedDate   = DateTime.Now;

                    context.Set <Order>().Attach(orderUpdate);
                    context.Entry(orderUpdate).State = EntityState.Modified;
                    context.SaveChanges();
                }
                return(RedirectToAction("Index"));
            }
            ViewBag.Ecards = EcardBusiness.AllNoTracking.Where(x => x.Draft != true).ToList();
            return(View(ViewNamesConstant.AdminOrdersEdit, Order));
        }