Пример #1
0
        public async Task <IActionResult> Edit(string id, [Bind("Id,Therapy_Name")] Therapy therapy)
        {
            if (id != therapy.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await _therapiesService.Update(therapy);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TherapyExists(therapy.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(therapy));
        }
Пример #2
0
        public async Task UpdateTest()
        {
            var fake             = Mock.Of <ITherapiesRepo>();
            var therapiesService = new TherapiesService(fake);

            var therapy = new Therapy()
            {
                Therapy_Name = "Module 2"
            };
            await therapiesService.Update(therapy);
        }