Ejemplo n.º 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));
            }
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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 }));
        }
Ejemplo n.º 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 }));
        }
Ejemplo n.º 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 }));
        }
Ejemplo n.º 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 }));
        }