Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("RefProgramDeliveryTypeId,ProgramDeliveryTypeCode,ProgramDeliveryType")] RefProgramDeliveryType refProgramDeliveryType)
        {
            if (id != refProgramDeliveryType.RefProgramDeliveryTypeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(refProgramDeliveryType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RefProgramDeliveryTypeExists(refProgramDeliveryType.RefProgramDeliveryTypeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }

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

                return(RedirectToAction(nameof(Index)));
            }
            return(View(refProgramDeliveryType));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("RefProgramDeliveryTypeId,ProgramDeliveryTypeCode,ProgramDeliveryType")] RefProgramDeliveryType refProgramDeliveryType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(refProgramDeliveryType);
                await _context.SaveChangesAsync();

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

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