public ActionResult DeleteConfirmed(int id)
        {
            TailorAttendance tailorAttendance = db.TailorAttendances.Find(id);

            db.TailorAttendances.Remove(tailorAttendance);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "TailorAttendanceId,TailoringEmployeeId,AttDate,EntryTime,Status,Remarks")] TailorAttendance tailorAttendance)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tailorAttendance).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.TailoringEmployeeId = new SelectList(db.Tailors, "TailoringEmployeeId", "StaffName", tailorAttendance.TailoringEmployeeId);
     return(View(tailorAttendance));
 }
        public async Task <IActionResult> Create([Bind("TailorAttendanceId,TailoringEmployeeId,AttDate,EntryTime,Status,Remarks")] TailorAttendance tailorAttendance)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tailorAttendance);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData ["TailoringEmployeeId"] = new SelectList(_context.TailoringEmployees, "TailoringEmployeeId", "StaffName", tailorAttendance.TailoringEmployeeId);
            return(PartialView(tailorAttendance));
        }
        // GET: TailorAttendances/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TailorAttendance tailorAttendance = db.TailorAttendances.Find(id);

            if (tailorAttendance == null)
            {
                return(HttpNotFound());
            }
            return(PartialView(tailorAttendance));
        }
        // GET: TailorAttendances/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TailorAttendance tailorAttendance = db.TailorAttendances.Find(id);

            if (tailorAttendance == null)
            {
                return(HttpNotFound());
            }
            ViewBag.TailoringEmployeeId = new SelectList(db.Tailors, "TailoringEmployeeId", "StaffName", tailorAttendance.TailoringEmployeeId);
            return(View(tailorAttendance));
        }
        [Authorize(Roles = "Admin,PowerUser")][Authorize(Roles = "Admin,PowerUser")]     public async Task <IActionResult> Edit(int id, [Bind("TailorAttendanceId,TailoringEmployeeId,AttDate,EntryTime,Status,Remarks")] TailorAttendance tailorAttendance)
        {
            if (id != tailorAttendance.TailorAttendanceId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tailorAttendance);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TailorAttendanceExists(tailorAttendance.TailorAttendanceId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData ["TailoringEmployeeId"] = new SelectList(_context.TailoringEmployees, "TailoringEmployeeId", "StaffName", tailorAttendance.TailoringEmployeeId);
            return(PartialView(tailorAttendance));
        }