Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("RefTLMSubjectId,TLMSubjectCode,TLMSubject")] RefTLMSubject refTLMSubject)
        {
            if (id != refTLMSubject.RefTLMSubjectId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(refTLMSubject);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RefTLMSubjectExists(refTLMSubject.RefTLMSubjectId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }

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

                return(RedirectToAction(nameof(Index)));
            }
            return(View(refTLMSubject));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("RefTLMSubjectId,TLMSubjectCode,TLMSubject")] RefTLMSubject refTLMSubject)
        {
            if (ModelState.IsValid)
            {
                _context.Add(refTLMSubject);
                await _context.SaveChangesAsync();

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

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