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)); }
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)); }
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); } }
public ActionResult Edit(Order order) { if (ModelState.IsValid) { db.Entry(order).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(order)); }