示例#1
0
        public JsonResult assignDetail(string idCar, int articleId)
        {
            getArticleIdsWithState gs = _db.getArticleIdsWithState
                                        .Where(g => g.articleID == articleId && g.carID == idCar).FirstOrDefault();

            if (gs != null)
            {
                if (gs.SortNo == 1)
                {
                    return(Json("exist"));
                }
                else
                {
                    getArticleIdsWithState gn = gs;
                    gn.SortNo = 1;
                    _db.Entry(gs).CurrentValues.SetValues(gn);
                    _db.SaveChanges();
                    return(Json(gn));
                }
            }
            else
            {
                getArticleIdsWithState ga = new getArticleIdsWithState()
                {
                    articleID = articleId,
                    carID     = idCar,
                    SortNo    = 1
                };
                _db.getArticleIdsWithState.Add(ga);
                _db.SaveChanges();
                return(Json(ga));
            }
        }
示例#2
0
        public JsonResult UpdateDetails(getArticleIdsWithState ga)
        {
            getArticleIdsWithState gold = db.getArticleIdsWithState.Where(g => g.carID == ga.carID && g.articleID == ga.articleID).FirstOrDefault();

            db.Entry(gold).CurrentValues.SetValues(ga);
            db.SaveChanges();
            return(Json(gold));
        }
示例#3
0
        public ActionResult RemoveDetail(int articleId, string carId)
        {
            getArticleIdsWithState aos = db.getArticleIdsWithState.Where(ao => ao.articleID == articleId && ao.carID == carId).FirstOrDefault();

            if (aos != null)
            {
                db.getArticleIdsWithState.Remove(aos);
                db.SaveChanges();
            }
            return(RedirectToAction("ResRecherche", "Article", new { id = articleId }));
        }
示例#4
0
        public ActionResult AssignArticle(int articleId, string detailId)
        {
            getArticleIdsWithState ga = new getArticleIdsWithState()
            {
                articleID = articleId,
                carID     = detailId,
                SortNo    = 1
            };

            db.getArticleIdsWithState.Add(ga);
            db.SaveChanges();

            return(RedirectToAction("Details", new { id = detailId }));
        }
示例#5
0
        public ActionResult Affdetailles(string carId, int articleId)
        {
            getArticleIdsWithState ga = new getArticleIdsWithState()
            {
                articleID = articleId,
                carID     = carId,
                SortNo    = 1
            };

            _db.getArticleIdsWithState.Add(ga);
            _db.SaveChanges();

            return(RedirectToAction("Affdetailles", new { id = articleId }));
        }
示例#6
0
        public ActionResult AssignDetails(int articleId, string carId)
        {
            getArticleIdsWithState gs = new getArticleIdsWithState()
            {
                articleID = articleId,
                carID     = carId,
                SortNo    = 1
            };

            _db.getArticleIdsWithState.Add(gs);
            _db.SaveChanges();

            return(RedirectToAction("ResRecherche", new { id = articleId }));
        }