Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Title,Description,Link,State,Id")] CapsuleInformative capsuleInformative)
        {
            if (id != capsuleInformative.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await _capsuleInformativeRepo.Update(capsuleInformative);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CapsuleInformativeExists(capsuleInformative.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(capsuleInformative));
        }
Esempio n. 2
0
        private async void Une_capsule()
        {
            var mockRepo     = new MockCapsulesInformativesRepository();
            var signalements = await mockRepo.GetAll();

            _capsuleInformative = signalements.First();
        }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("Title,Description,Link,Status,Id")] CapsuleInformative capsuleInformative)
        {
            if (ModelState.IsValid)
            {
                await _capsuleInformativeRepo.Add(capsuleInformative);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(capsuleInformative));
        }