コード例 #1
0
        public ActionResult AddStoreFollow(int ID)
        {
            if (User.Identity.IsAuthenticated == false)
            {
                return(Json("You must login to Follow", JsonRequestBehavior.AllowGet));
            }
            UserProfile user = UserProfiles_Logic.GetUserProfileByUserName(User.Identity.Name);
            Follow      temp = new Follow();

            temp.UserId  = user.UserId;
            temp.StoreId = ID;

            if (Follow_Logic.AddNewFollow(temp))
            {
                Store store = db.Stores.Find(ID);
                ++store.TotalFollowers;
                db.Entry(store).State = EntityState.Modified;
                db.SaveChanges();

                // Publish Message
                Message_Logic.PublishMessage(WebSecurity.CurrentUserId, Constant.PRONOUN_TYPE_USER, ID, Constant.PRONOUN_TYPE_STORE, Constant.MESSAGE_TYPE_FOLLOW);
                return(Json("true", JsonRequestBehavior.AllowGet));
            }
            return(Json("false", JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public ActionResult MarkAsRead(int MessageId)
        {
            try
            {
                MessageRecipient rep = db.Messages.Find(MessageId).Recipients.Where(r => r.RecipientId == WebSecurity.CurrentUserId).FirstOrDefault();

                rep.IsRead          = true;
                db.Entry(rep).State = EntityState.Modified;
                db.SaveChanges();
            }
            catch (Exception)
            {
                return(Json("false", JsonRequestBehavior.AllowGet));
            }
            return(Json("true", JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        public string UpdateProductStatus(int productID, string status)
        {
            Product product = db.Products.Where(p => p.ProductId == productID).FirstOrDefault();

            try
            {
                product.StatusId        = db.ProductStatuses.Where(s => s.Name.Trim().ToLower().Equals(status.Trim().ToLower())).FirstOrDefault().StatusId;
                db.Entry(product).State = EntityState.Modified;
                db.SaveChanges();
                return(Constant.ST_OK);
            }
            catch (Exception)
            {
                return(Constant.ST_NG);
            }
        }
コード例 #4
0
 public ActionResult Edit(Order order)
 {
     if (ModelState.IsValid)
     {
         db.Entry(order).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(order));
 }