Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("CurWageID,CurWage")] CurWageMgmt curWageMgmt)
        {
            if (id != curWageMgmt.CurWageID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(curWageMgmt);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CurWageMgmtExists(curWageMgmt.CurWageID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(curWageMgmt));
        }
        public static void CurWageInitaiizer(ApplicationDbContext context)
        {
            context.Database.EnsureCreated();

            if (context.CurWageMgmt.Any())
            {
                return;
            }

            var curwage = new CurWageMgmt[]
            {
                new CurWageMgmt {
                    CurWage = 15.00M
                }
            };

            foreach (CurWageMgmt c in curwage)
            {
                context.CurWageMgmt.Add(c);
            }
            context.SaveChanges();
        }