示例#1
0
        public ActionResult CreateAntrenori()
        {
            Antrenori antrenor = new Antrenori();

            antrenor.Clnt = new List <Client>();
            return(View());
        }
示例#2
0
        public ActionResult DeleteAntrenori(int id)
        {
            Antrenori antre = db.Antrenori.Find(id);

            if (antre != null)
            {
                db.Antrenori.Remove(antre);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(HttpNotFound(" " + id.ToString()));
        }
示例#3
0
        public ActionResult Details(int?id)
        {
            if (id.HasValue)
            {
                Antrenori antre = db.Antrenori.Find(id);

                if (antre != null)
                {
                    return(View(antre));
                }
                return(HttpNotFound("Nu s-a putut gasi antrenorul cu id-ul: " + id.ToString()));
            }
            return(HttpNotFound("Lipseste id-ul antrenorului!"));
        }
示例#4
0
        public ActionResult UpdateAntrenori(int?id)
        {
            if (id.HasValue)
            {
                Antrenori antre = db.Antrenori.Find(id);
                if (antre == null)
                {
                    return(HttpNotFound("Nu s-a putut gasi antrenorul cu id-ul:" + id.ToString()));
                }

                return(View(antre));
            }
            return(HttpNotFound("Nu exista antrenorul cu paramtreul specificat"));
        }
示例#5
0
 public ActionResult CreateAntrenori(Antrenori antrenoriRequest)
 {
     try
     {
         if (ModelState.IsValid)
         { //vom sterge ulterior
           // antrenoriRequest.Clnt = (ICollection<Client>)db.Clienti.FirstOrDefault(
             //   p => p.IdClient.Equals(1));
             db.Antrenori.Add(antrenoriRequest);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         return(View(antrenoriRequest));
     }
     catch (Exception e)
     {
         return(View(antrenoriRequest));
     }
 }
示例#6
0
        public ActionResult UpdateAntrenori(int id, Antrenori antreRequest)
        {
            Antrenori antre = db.Antrenori.SingleOrDefault(b => b.IdAntrenori.Equals(id));

            try

            {
                if (ModelState.IsValid)
                {
                    if (TryUpdateModel(antre))
                    {
                        antre.Nume = antreRequest.Nume;
                        db.SaveChanges();
                    }
                    RedirectToAction("Index");
                }
                return(View(antreRequest));
            }
            catch (Exception e)
            {
                return(View(antreRequest));
            }
        }