Beispiel #1
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Entry entryAux = _entriesRepository.GetEntry((int)id);

            ViewBag.ListDropDown = new SelectList(Data.Data.Activities, "Id", "Name");

            return(View(entryAux));
        }
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            //Get the requested entry from the repository
            Entry entry = _entriesRepository.GetEntry((int)id);

            //Return a status of "not found " if entry wasn't found
            if (entry == null)
            {
                return(HttpNotFound());
            }

            //Populate the activities select list items ViewBag property.
            SetupActivitiesSelectListItems();

            //Pass entry into the view.
            return(View(entry));
        }
Beispiel #3
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            // TODO get the requested entry from the repository

            Entry entry = _entriesRepository.GetEntry((int)id);

            // TODO return a status of "not found" if the entry wasn't found

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

            // TODO pass the entry into the view

            SetupActivitiesSelectListItems();

            return(View(entry));
        }
Beispiel #4
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            //ToDo - get the requested entry from the repository, also make sure an entry is found, and if not,

            Entry entry = _entriesRepository.GetEntry((int)id);

            //ToDo -  return a status of not found if the entry was not found

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

            // todo - populate the activities select list items ViewBag property
            SetupActivitiesSelectListItems();
            //ToDo - pass the entry into the view

            return(View(entry));
        }
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Entry entry = _entriesRepository.GetEntry((int)id);

            if (entry == null)
            {
                return(HttpNotFound());
            }
            SetupActivitiesSelectListItems();
            return(View(entry));
        }
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SetupActivitiesSelectList();

            try {
                int i = Convert.ToInt32(id);
                return(View(_entriesRepository.GetEntry(i)));
            }
            catch (Exception e)
            {
                return(View());
            }
        }
        // Add Entry page
        public ActionResult AddEdit(int?id)
        {
            // get the defined band specifications for the add page band color selections
            List <Band> bands = _bandsRepository.GetBands();

            // check if it is an Add or and Edit
            if (id == null)
            {
                ViewBag.Title            = "Add Entry";
                ViewData["ID"]           = 0;
                ViewData["Date"]         = DateTime.Now.ToString("yyyy-MM-dd");
                ViewData["BandColor1ID"] = 0;
                ViewData["BandColor2ID"] = 0;
                ViewData["BandColor3ID"] = 0;
                ViewData["BandColor4ID"] = 0;
                ViewData["Resistance"]   = "";
                ViewData["Notes"]        = "";
            }
            else
            {
                ViewBag.Title = "Edit Entry";
                Entry entry = _entriesRepository.GetEntry(id.GetValueOrDefault(0));
                if (entry != null)
                {
                    ViewData["ID"]           = entry.ID;
                    ViewData["Date"]         = entry.EntryData.Date.ToString("yyyy-MM-dd");
                    ViewData["BandColor1ID"] = entry.EntryData.BandColor1ID;
                    ViewData["BandColor2ID"] = entry.EntryData.BandColor2ID;
                    ViewData["BandColor3ID"] = entry.EntryData.BandColor3ID;
                    ViewData["BandColor4ID"] = entry.EntryData.BandColor4ID;
                    ViewData["Resistance"]   = entry.EntryData.Resistance;
                    ViewData["Notes"]        = entry.EntryData.Notes.Replace("@@", "\r\n");
                }
            }

            return(View(bands));
        }