Ejemplo n.º 1
0
        public async Task <IActionResult> DeleteProduction(int userId, int id)
        {
            if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                return(Unauthorized());
            }

            var prodToDelete = await _repo.GetProduction(id);

            if (userId == int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                _repo.Delete(prodToDelete);
            }
            await _repo.SaveAll();

            return(Ok(
                       prodToDelete.Date.ToString("MM/dd/yyyy")
                       + " "
                       + prodToDelete.Shift
                       + " shift production for Op# "
                       + prodToDelete.OpNumber
                       + " running on the "
                       + prodToDelete.Machine
                       + " was deleted!"
                       ));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> DeleteMachine(int userId, string mach)
        {
            if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                return(Unauthorized());
            }

            var machToDelete = await _repo.GetMachine(userId, mach);

            if (userId == int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                _repo.Delete(machToDelete);
            }
            await _repo.SaveAll();

            return(Ok(machToDelete.Machine + " was deleted!"));
        }
        public async Task <IActionResult> DeletePart(int userId, string part)
        {
            if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                return(Unauthorized());
            }

            var partToDelete = await _repo.GetPart(userId, part);

            if (userId == int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                _repo.Delete(partToDelete);
            }
            await _repo.SaveAll();

            return(Ok(
                       partToDelete.PartNumber
                       + " and any associated Jobs, Ops, Production, and Hourly Tracking was deleted!"
                       ));
        }
        public async Task <IActionResult> DeleteJob(int userId, string jobNum)
        {
            if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                return(Unauthorized());
            }

            var jobToDelete = await _repo.GetJob(userId, jobNum);

            if (userId == int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                _repo.Delete(jobToDelete);
            }
            await _repo.SaveAll();

            return(Ok(
                       "Job# "
                       + jobToDelete.JobNumber
                       + " was deleted, along with related production lots and hourly counts!"
                       ));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> DeleteHourly(int userId, int id)
        {
            if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                return(Unauthorized());
            }

            var hourlyToDelete = await _repo.GetHourly(id);

            if (userId == int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                _repo.Delete(hourlyToDelete);
            }
            await _repo.SaveAll();

            return(Ok(
                       hourlyToDelete.Time
                       + " hourly count for job# "
                       + hourlyToDelete.JobNumber
                       + " running on the "
                       + hourlyToDelete.Machine
                       + " was deleted!"
                       ));
        }