Esempio n. 1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("ID,Divisor,Name")] PolicyFrequency policyFrequency)
        {
            if (id != policyFrequency.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(policyFrequency);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PolicyFrequencyExists(policyFrequency.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(policyFrequency));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("ID,Divisor,Name")] PolicyFrequency policyFrequency)
        {
            if (ModelState.IsValid)
            {
                policyFrequency.ID = Guid.NewGuid();
                _context.Add(policyFrequency);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(policyFrequency));
        }