Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Emplid,HourstoAllocate,EffectiveDate,ExpirationDate,LastUpdateBy,LastUpdateDate,AllocationStaffId")] AllocationStaff allocationStaff)
        {
            ViewBag.name   = HttpContext.Session.GetString("name");
            ViewBag.emplid = HttpContext.Session.GetString("emplid");

            if (id != allocationStaff.AllocationStaffId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(allocationStaff);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AllocationStaffExists(allocationStaff.AllocationStaffId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(allocationStaff));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("Emplid,HourstoAllocate,EffectiveDate,ExpirationDate,InsertBy,InsertDate,AllocationStaffId")] AllocationStaff allocationStaff)
        {
            if (ModelState.IsValid)
            {
                _context.Add(allocationStaff);
                await _context.SaveChangesAsync();

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