Пример #1
0
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                //instantiem modelul
                Models.SoccerMatchModel soccerMatchModel = new Models.SoccerMatchModel();

                //incarcam datele in model
                UpdateModel(soccerMatchModel);

                if (User.Identity.IsAuthenticated)
                {
                    soccerMatchModel.Stadium   = User.Identity.Name + " - add stadium " + soccerMatchModel.Stadium;
                    soccerMatchModel.GuestTeam = User.Identity.Name + " - add guest team " + soccerMatchModel.GuestTeam;
                    soccerMatchModel.HomeTeam  = User.Identity.Name + " - add home team " + soccerMatchModel.HomeTeam;
                }

                //apelam sursa sa salveze datele
                soccerMatchRepository.InsertMatch(soccerMatchModel);

                //redirectare catre index in caz de succes
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View("Create"));
            }
        }
 public HttpResponseMessage Put(Guid id, [FromBody] Models.SoccerMatchModel value)
 {
     try
     {
         //apelam resursa care salveaza datele
         soccerMatchResource.UpdateMatch(value);
         return(ToJson(true));
     }
     catch
     {
         return(ToJson(false));
     }
 }
Пример #3
0
        public ActionResult Edit(Guid id, FormCollection collection)
        {
            try
            {
                //instantiem modelul
                Models.SoccerMatchModel soccerMatchModel = new Models.SoccerMatchModel();

                //incarcare date din model
                UpdateModel(soccerMatchModel);

                //apelam resursa care salveaza datele
                soccerMatchRepository.UpdateMatch(soccerMatchModel);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View("Edit"));
            }
        }
Пример #4
0
        // GET: SoccerMatch/Edit/5
        public ActionResult Edit(Guid id)
        {
            Models.SoccerMatchModel soccerMatchModel = soccerMatchRepository.GetMatchByID(id);

            return(View("Edit", soccerMatchModel));
        }
Пример #5
0
        // GET: SoccerMatch/Details/5
        public ActionResult Details(Guid id)
        {
            Models.SoccerMatchModel soccerMatchModel = soccerMatchRepository.GetMatchByID(id);

            return(View("Details", soccerMatchModel));
        }