Exemple #1
0
        public async Task UpdateSetAsync_WhenCalled_UpdateSetAsync()
        {
            var set = _setUpContext.Sets.Find(1);

            set.Name = "New name";

            await _setService.UpdateSetAsync(set);

            var setInDb = _context.Sets.Find(1);

            Assert.That(setInDb.Name, Is.EqualTo("New name"));
        }
        public async Task <JsonResult> EditSet([FromBody] GroupBind id)
        {
            try
            {
                var set = JsonConvert.DeserializeObject <Set>(id.group);
                await _setService.UpdateSetAsync(set);

                return(Json("")); //return null;
            }
            catch
            {
                return(null);
            }
        }
Exemple #3
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            try
            {
                await _setService.UpdateSetAsync(this.Set);
            }
            catch (DbUpdateConcurrencyException)
            {
                return(NotFound());
            }

            return(RedirectToPage("./Index"));
        }