Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,StatName")] Status status)
        {
            if (id != status.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(status);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StatusExists(status.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(status));
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,ResTitle,ResFirst,ResMiddle,ResLast,ResEmail,ResBio")] Researcher researcher)
        {
            if (id != researcher.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(researcher);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ResearcherExists(researcher.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(researcher));
        }
Пример #3
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,KeyWord")] Keyword keyword)
        {
            if (id != keyword.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(keyword);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!KeywordExists(keyword.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(keyword));
        }
Пример #4
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,ReSponse")] ReviewAgain reviewAgain)
        {
            if (id != reviewAgain.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(reviewAgain);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ReviewAgainExists(reviewAgain.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(reviewAgain));
        }
Пример #5
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,PaperID,ResID,RoleID,RevContentReview,RevKeywordReview,RevLengthReview,RevFormatReview,RevCitationReview,RecID,ReRevID")] ReviewAssign reviewAssign)
        {
            if (id != reviewAssign.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(reviewAssign);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ReviewAssignExists(reviewAssign.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RoleID"] = new SelectList(_context.Roles, "ID", "RoleTitle", reviewAssign.RoleID);
            return(View(reviewAssign));
        }
Пример #6
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,PaperTitle,PaperAbstract,PaperType,PaperLength,StatID")] PaperInfo paperInfo)
        {
            if (id != paperInfo.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(paperInfo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PaperInfoExists(paperInfo.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(paperInfo));
        }
Пример #7
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,FileName,TypeID")] File file)
        {
            if (id != file.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(file);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FileExists(file.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(file));
        }
Пример #8
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,RevID,ComAccess,Comtext")] Comment comment)
        {
            if (id != comment.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(comment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CommentExists(comment.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(comment));
        }
Пример #9
0
        public async Task <IActionResult> Edit(int id, string[] selectedOptions)
        {
            var researcherToUpdate = await _context.Researchers
                                     .Include(ri => ri.Institutes)
                                     .Include(r => r.ResearchExpertises)
                                     .ThenInclude(re => re.Expertise)
                                     .Include(r => r.Institutes)
                                     .Include(r => r.Title)
                                     .SingleOrDefaultAsync(m => m.ID == id);

            if (researcherToUpdate == null)
            {
                return(NotFound());
            }

            UpdateResearcherExpertises(selectedOptions, researcherToUpdate);


            if (await TryUpdateModelAsync <Researcher>(researcherToUpdate, "",
                                                       r => r.TitleID, r => r.ResFirst, r => r.ResMiddle, r => r.ResLast, r => r.ResBio, r => r.ResEmail, r => r.InstituteID))
            {
                try
                {
                    _context.Update(researcherToUpdate);
                    await _context.SaveChangesAsync();

                    UpdateUserNameCookie(researcherToUpdate.ResEmail);
                    return(RedirectToAction(nameof(Index)));
                }
                catch (RetryLimitExceededException /* dex */)
                {
                    ModelState.AddModelError("", "Unable to save changes after multiple attempts. Try again, and if the problem persists, see your system administrator.");
                }
                catch (DbUpdateException)
                {
                    ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
                }
            }
            PopulateAssignedExpertiseData(researcherToUpdate);
            PopulateDropDownLists();
            return(View(researcherToUpdate));
        }
Пример #10
0
        public async Task <IActionResult> Update(int id)
        {
            var reviewAssignToUpdate = await _context.ReviewAssigns
                                       .Include(a => a.PaperInfo)
                                       .FirstOrDefaultAsync(m => m.ID == id);

            //Check you got the record
            if (reviewAssignToUpdate == null)
            {
                return(NotFound());
            }

            //Tey Updating with the new values
            if (await TryUpdateModelAsync <ReviewAssign>(reviewAssignToUpdate, "",
                                                         s => s.PaperInfoID, s => s.ResearcherID, s => s.RoleID, s => s.RevContentReview, s => s.RevKeywordReview, s => s.RevLengthReview,
                                                         s => s.RevFormatReview, s => s.RevCitationReview, s => s.EiCComment, s => s.AuthorComment, s => s.RecommendID, s => s.ReviewAgainID))
            {
                try
                {
                    _context.Update(reviewAssignToUpdate);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction("Index", new { reviewAssignToUpdate.PaperInfoID }));
                }

                catch (DbUpdateConcurrencyException)
                {
                    if (!ReviewAssignExists(reviewAssignToUpdate.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
            }