Esempio n. 1
0
        public async Task <IActionResult> Edit(string id, [Bind("Id,Desc,Url_Video,TherapyId")] Video video)
        {
            if (id != video.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await _videosService.Update(video);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VideoExists(video.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TherapyId"] = new SelectList(_videosService.getTherapies(), "Id", "Id", video.TherapyId);
            return(View(video));
        }
Esempio n. 2
0
        public async Task UpdateTest()
        {
            var fake         = Mock.Of <IVideosRepo>();
            var videoService = new VideosService(fake);

            var video = new Video()
            {
                Desc = "desc1", Url_Video = "url1", TherapyId = "2"
            };
            await videoService.Update(video);
        }