コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            NegotiationChatModels negotiationChatModels = db.NegotiationChatModels.Find(id);

            db.NegotiationChatModels.Remove(negotiationChatModels);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "ChatId,ChatDate,ChatText,OfferID,CustId,SuppId")] NegotiationChatModels negotiationChatModels)
 {
     if (ModelState.IsValid)
     {
         db.Entry(negotiationChatModels).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(negotiationChatModels));
 }
コード例 #3
0
        // GET: NegotiationChatModels/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            NegotiationChatModels negotiationChatModels = db.NegotiationChatModels.Find(id);

            if (negotiationChatModels == null)
            {
                return(HttpNotFound());
            }
            return(View(negotiationChatModels));
        }
コード例 #4
0
        public ActionResult Create([Bind(Include = "ChatText")] NegotiationChatModels negotiationChatModels, int?offerId)
        {
            var user_id = User.Identity.GetUserId();

            negotiationChatModels.MessageOwnerId = user_id;
            negotiationChatModels.ChatDate       = DateTime.Now;
            negotiationChatModels.OfferID        = (int)offerId;
            var offer = db.OfferModels.Where(off => off.OfferID == offerId).FirstOrDefault();

            negotiationChatModels.SuppId = offer.UserID;
            var req = db.RequestModels.Where(off => off.Offers.Where(o => o.OfferID == offerId).FirstOrDefault().OfferID == offerId).FirstOrDefault();

            negotiationChatModels.CustId = req.UserID;


            if (ModelState.IsValid)
            {
                db.NegotiationChatModels.Add(negotiationChatModels);
                db.SaveChanges();
                return(RedirectToAction("Negotiation", new { offerId }));
            }

            return(View(negotiationChatModels));
        }