Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ApprovalProjectId,SerialNo,ProjectName,MonumentalNo,ApprovalDate,StartDate,EndtDate,DonorId,AuditStatus,CertificateStatus,ApprovedMoney,CurrencyRate,TotalAcceptedMoney,ExpenseAmount,ProjectImplementAddress")] ApprovalProjects approvalProjects)
        {
            if (id != approvalProjects.ApprovalProjectId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(approvalProjects);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ApprovalProjectsExists(approvalProjects.ApprovalProjectId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }

            return(View(approvalProjects));
        }
Beispiel #2
0
        public async Task <IActionResult> Create(ApprovalProjects approvalProjects)
        {
            //var err = ModelState.Where(s=>s.Value.Errors.Any()).Select(x => new { x.Key, x.Value.Errors });
            if (ModelState.IsValid)
            {
                _context.Add(approvalProjects);
                await _context.SaveChangesAsync();

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

            return(View(approvalProjects));
        }