Esempio n. 1
0
        public async Task <IActionResult> UpdateShred(Shreds shredToUpdate)
        {
            if (ModelState.IsValid)
            {
                await _shredsRepo.Update(shredToUpdate);

                return(RedirectToAction("ShredSection", new { id = shredToUpdate.PaperId }));
            }
            return(RedirectToAction("ShredSection", new { id = shredToUpdate.PaperId }));
        }
Esempio n. 2
0
        /// <summary>
        /// The StartShred.
        /// </summary>
        /// <param name="id">The id<see cref="int"/>.</param>
        /// <returns>The <see cref="Task{IActionResult}"/>.</returns>
        public async Task <IActionResult> StartShred(int id)
        {
            var getPaperCreator = await _paperRepo.Read(id);

            if (getPaperCreator != null)
            {
                Shreds newShred = new Shreds
                {
                    Date     = DateTime.UtcNow,
                    PaperId  = id,
                    ShredyId = getPaperCreator.ShrederId
                };

                return(PartialView("_StartShred", newShred));
            }
            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
        public async Task <IActionResult> SubmitShred(Shreds shredCreated)
        {
            var shredCheck = await _shredsRepo.GetAllShredsForPaper(shredCreated.PaperId);

            if (shredCheck != null)
            {
                //check to see if the user has already submitted a shred.
                var check = shredCheck.Where(x => x.ShrederId == shredCreated.ShrederId);

                if (check.Count() == 0)
                {
                    var create = await _shredsRepo.Create(shredCreated);

                    return(RedirectToAction("ShredSection", new { id = shredCreated.PaperId }));
                }
                else
                {
                }

                return(RedirectToAction("ShredSection", new { id = shredCreated.PaperId }));
            }
            return(RedirectToAction("ShredSection", new { id = shredCreated.PaperId }));
        }