Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("RefSchoolStatusId,SchoolStatusCode,SchoolStatus")] RefSchoolStatus refSchoolStatus)
        {
            if (id != refSchoolStatus.RefSchoolStatusId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(refSchoolStatus);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RefSchoolStatusExists(refSchoolStatus.RefSchoolStatusId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }

                TempData["messageType"]  = "success";
                TempData["messageTitle"] = "RECORD UPDATED";
                TempData["message"]      = "Record successfully updated";

                return(RedirectToAction(nameof(Index)));
            }
            return(View(refSchoolStatus));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("RefSchoolStatusId,SchoolStatusCode,SchoolStatus")] RefSchoolStatus refSchoolStatus)
        {
            if (ModelState.IsValid)
            {
                _context.Add(refSchoolStatus);
                await _context.SaveChangesAsync();

                TempData["messageType"]  = "success";
                TempData["messageTitle"] = "RECORD CREATED";
                TempData["message"]      = "New record successfully created";

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