public IHttpActionResult PutAchievement(int id, Achievement achievement) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != achievement.ID) { return(BadRequest()); } db.Entry(achievement).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AchievementExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IActionResult MediaForm(Accomplishment accomplishment) { if (ModelState.IsValid) { _context.Add(accomplishment); _context.SaveChanges(); return(RedirectToAction("Index")); } return(View(accomplishment)); }
// ====================== Supervisor Updates An employee's Accomplishment Submission ================================ public IActionResult Approve(int id) { var accomplishment = _context.Accomplishments.FirstOrDefault(a => a.AchievementID == id); accomplishment.IsApproved = true; accomplishment.DateApproved = DateTime.Now; if (ModelState.IsValid) { _context.Update(accomplishment); _context.SaveChanges(); return(RedirectToAction("Approvals")); } return(RedirectToAction("ApprovalView", id)); }
public IActionResult Index(PMISUser user) { if (ModelState.IsValid) { _context.Update(user); _context.SaveChanges(); return(RedirectToAction("ProfileUpdated")); } return(View(user)); }
public ActionResult CreateAchievement(NewAchievement NA) { var user = System.Web.HttpContext.Current.User; var game = AC.Games.FirstOrDefault(x => x.GameID == NA.NewAchievementID); //var currentuser = Membership.GetUser(User.Identity.Name); var achievement = new UserAchievement() { ThiefLives = NA.ThiefLives, ThiefTries = NA.ThiefTries, UserID = user.Identity.Name, Game = game }; AC.Achievements.Add(achievement); AC.SaveChanges(); return(new HttpStatusCodeResult(HttpStatusCode.OK)); }