public ActionResult DeleteConfirmed(int id)
        {
            Psikolog psikolog = db.Psikologlar.Find(id);

            db.Psikologlar.Remove(psikolog);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "Id,Name,Description,Price,Stock,Image,IsHome,IsApproved,CategoryId")] Psikolog psikolog)
 {
     if (ModelState.IsValid)
     {
         db.Entry(psikolog).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CategoryId = new SelectList(db.Categories, "Id", "Name", psikolog.CategoryId);
     return(View(psikolog));
 }
        public ActionResult Create([Bind(Include = "Id,Name,Description,Info1,Info2,Info3,Info4,Info5,Info6,Info7,Info8,Info9,Info10,Price,Stock,Image,IsHome,IsApproved,CategoryId")] Psikolog psikolog)
        {
            if (ModelState.IsValid)
            {
                db.Psikologs.Add(psikolog);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CategoryId = new SelectList(db.Categories, "Id", "Name", psikolog.CategoryId);
            return(View(psikolog));
        }
        // GET: Product/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Psikolog psikolog = db.Psikologlar.Find(id);

            if (psikolog == null)
            {
                return(HttpNotFound());
            }
            return(View(psikolog));
        }
        // GET: Product/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Psikolog psikolog = db.Psikologlar.Find(id);

            if (psikolog == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CategoryId = new SelectList(db.Categories, "Id", "Name", psikolog.CategoryId);
            return(View(psikolog));
        }
Beispiel #6
0
        public void AddPsikolog(Psikolog psikolog, int quantity)
        {
            var line = _cardLines.FirstOrDefault(i => i.Psikolog.Id == psikolog.Id);

            if (line == null)
            {
                _cardLines.Add(new CartLine()
                {
                    Psikolog = psikolog, Quantity = quantity
                });
            }
            else
            {
                line.Quantity += quantity;
            }
        }
Beispiel #7
0
 public void DeletePsikolog(Psikolog psikolog)
 {
     _cardLines.RemoveAll(i => i.Psikolog.Id == psikolog.Id);
 }