コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("RefLocationTypeId,LocationTypeCode,LocationType,LocationLevel")] RefLocationType refLocationType)
        {
            if (id != refLocationType.RefLocationTypeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(refLocationType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RefLocationTypeExists(refLocationType.RefLocationTypeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }

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

                return(RedirectToAction(nameof(Index)));
            }
            return(View(refLocationType));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("RefLocationTypeId,LocationTypeCode,LocationType,LocationLevel")] RefLocationType refLocationType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(refLocationType);
                await _context.SaveChangesAsync();

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

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