Пример #1
0
        public async Task <IActionResult> Create([Bind("PR_NAME")] Producer producer)
        {
            try {
                if (ModelState.IsValid)
                {
                    _context.Add(producer);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
            }
            catch (DbUpdateException /* ex */)
            {
                //Log the error (uncomment ex variable name and write a log.
                ModelState.AddModelError("", "Unable to save changes. " +
                                         "Try again, and if the problem persists " +
                                         "see your system administrator.");
            }
            return(View(producer));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("MS_ID,GR_ID,MUC_YEAR,MUS_LYEAR")] Musicians_in_groups musicians_in_groups)
        {
            try {
                if (ModelState.IsValid)
                {
                    _context.Add(musicians_in_groups);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
            }
            catch (DbUpdateException /* ex */)
            {
                //Log the error (uncomment ex variable name and write a log.
                ModelState.AddModelError("", "Unable to save changes. " +
                                         "Try again, and if the problem persists " +
                                         "see your system administrator.");
            }
            return(View(musicians_in_groups));
        }