Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("AuditPdlFormIrecNo,FinancialYear,District,Institutions,CentreInstitutionDetails,PendencyReasons")] AuditPdlFormI auditPdlFormI)
        {
            using (var _context = new auditinternalContext())
            {
                ViewBag.ListOfFinancialYear = _context.TblMasterFinancialyear.ToList();
                ViewBag.ListOfDistrict      = _context.TblMasterDistrict.ToList();
                ViewBag.ListOfInstitutions  = _context.TblMasterInstitutions.ToList();
            }
            if (id != auditPdlFormI.AuditPdlFormIrecNo)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(auditPdlFormI);
                    var result = await _context.SaveChangesAsync();

                    if (result == 1)
                    {
                        Result          = "Updated";
                        ViewData["Msg"] = new MessageDTO {
                            Message = "Dear User,<br/>Details Successfully Updated!!.", Status = "S", BackPageAction = "Index", BackPageController = "AuditFormI"
                        };
                    }
                    else
                    {
                        ViewData["Msg"] = new MessageDTO {
                            Message = "Dear User,<br/><b>Some Error Ocurred Please try Later. if the problem persists contact your system administrator..", Status = "E", BackPageAction = "Index", BackPageController = "AuditFormI"
                        };
                    }
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AuditPdlFormIExists(auditPdlFormI.AuditPdlFormIrecNo))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
            }
            return(View(auditPdlFormI));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("AuditPdlFormIrecNo,FinancialYear,District,Institutions,CentreInstitutionDetails,PendencyReasons")] AuditPdlFormI auditPdlFormI)
        {
            using (var _context = new auditinternalContext())
            {
                ViewBag.ListOfFinancialYear = _context.TblMasterFinancialyear.ToList();
                ViewBag.ListOfDistrict      = _context.TblMasterDistrict.ToList();
                ViewBag.ListOfInstitutions  = _context.TblMasterInstitutions.ToList();
            }
            if (ModelState.IsValid)
            {
                _context.Add(auditPdlFormI);
                var result = await _context.SaveChangesAsync();

                if (result == 1)
                {
                    Result          = "Saved";
                    ViewData["Msg"] = new MessageDTO {
                        Message = "Dear User,<br/>Details Successfully Saved!!.", Status = "S", BackPageAction = "Index", BackPageController = "AuditFormI"
                    };
                }
                else
                {
                    ViewData["Msg"] = new MessageDTO {
                        Message = "Dear User,<br/><b>Some Error Ocurred Please try Later. if the problem persists contact your system administrator..", Status = "E", BackPageAction = "Index", BackPageController = "AuditFormI"
                    };
                }
            }
            return(View(auditPdlFormI));


            //if (ModelState.IsValid)
            //{
            //    _context.Add(auditPdlFormI);
            //    await _context.SaveChangesAsync();
            //    return RedirectToAction(nameof(Index));
            //}
            //return View(auditPdlFormI);
        }