Ejemplo n.º 1
0
        // GET: Commentaire/Edit/5
        public ActionResult Edit(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            commentaires          p  = cs.GetById(id);
            CommentaireViewModels p1 = new CommentaireViewModels()
            {
                note        = p.note,
                text        = p.text,
                employ_U_ID = p.employ_U_ID
            };

            if (p == null)
            {
                return(HttpNotFound());
            }

            return(View(p1));
        }
Ejemplo n.º 2
0
        public ActionResult Create(CommentaireViewModels cvm, int arg)
        {
            commentaires c = new commentaires();

            c.note        = cvm.note;
            c.text        = cvm.text;
            c.employ_U_ID = arg;

            cs.Add(c);
            cs.Commit();

            try
            {
                // TODO: Add insert logic here

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Ejemplo n.º 3
0
        public ActionResult Edit(int id, CommentaireViewModels c)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (id == null)
                    {
                        return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                    }
                    commentaires p = cs.GetById(id);

                    p.note        = c.note;
                    p.text        = c.text;
                    p.employ_U_ID = c.employ_U_ID;
                    // p.Employee_U_ID = f.Employee_U_ID;

                    if (p == null)
                    {
                        return(HttpNotFound());
                    }

                    Console.WriteLine("updaaaaaaaaaaaate");
                    cs.Update(p);
                    cs.Commit();
                    // Service.Dispose();

                    return(RedirectToAction("Index"));
                }
                // TODO: Add delete logic here
                return(View(c));
            }
            catch
            {
                return(View());
            }
        }