public ActionResult Create(FormCollection collection)
        {
            try
            {
                //instantiem modelul
                Models.LeagueModel leagueModel = new Models.LeagueModel();

                //incarcam datele in model
                UpdateModel(leagueModel);

                if (User.Identity.IsAuthenticated)
                {
                    leagueModel.Country = User.Identity.Name + " - add country " + leagueModel.Country;
                }

                //apelam sursa sa salveze datele
                leagueRepository.InsertLeague(leagueModel);

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

                //incarcare date din model
                UpdateModel(leagueModel);

                //apelam resursa care salveaza datele
                leagueRepository.UpdateLeague(leagueModel);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View("Edit"));
            }
        }
        // GET: League/Edit/5
        public ActionResult Edit(Guid id)
        {
            Models.LeagueModel leagueModel = leagueRepository.GetLeagueByID(id);

            return(View("Edit", leagueModel));
        }
        // GET: League/Details/5
        public ActionResult Details(Guid id)
        {
            Models.LeagueModel leagueModel = leagueRepository.GetLeagueByID(id);

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