public IHttpActionResult PutUser_Comment(int id, User_Comment user_Comment) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != user_Comment.Id) { return(BadRequest()); } db.Entry(user_Comment).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!User_CommentExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
private void SetEventDetails(SavedEvent @event) { DateAndTime currDate = new DateAndTime(TimeAndDateUtility.GetCurrentDate(), TimeAndDateUtility.GetCurrentTime()); DateAndTime eventStartDate = @event.ActivationDate; DateAndTime eventEndDate = @event.DeactivationDate; Exp_Start_Date.SetText(TimeAndDateUtility.ConvertDate_String(@event.ActivationDate.Date, true)); Exp_Start_Time.SetText(TimeAndDateUtility.ConvertTime_String(@event.ActivationDate.Time)); Exp_End_Date.SetText(TimeAndDateUtility.ConvertDate_String(@event.DeactivationDate.Date, true)); Exp_End_Time.SetText(TimeAndDateUtility.ConvertTime_String(@event.DeactivationDate.Time)); Created_Date.SetText( $"{TimeAndDateUtility.ConvertDate_String(@event.CreatedDate.Date, true)} {TimeAndDateUtility.ConvertTime_String(@event.CreatedDate.Time)}"); Completion_Date.SetText( @event.Completed && @event.CompletedDate != null && @event.CompletedDate.Date != null && @event.CompletedDate.Time != null ? $"{TimeAndDateUtility.ConvertDate_String(@event.CompletedDate.Date, true)} {TimeAndDateUtility.ConvertTime_String(@event.CompletedDate.Time)}" : DASH); Event_Status.SetText( @event.Completed ? "Complete" : TimeAndDateUtility.IsBeforeRange(eventStartDate, currDate) ? "Upcoming" : TimeAndDateUtility.IsWithinRange(eventStartDate, currDate, eventEndDate) ? "In Progress" : "Overdue"); Event_Status.SetBackColor( @event.Completed ? Color.DarkGreen : TimeAndDateUtility.IsBeforeRange(eventStartDate, currDate) ? Color.DarkGray : TimeAndDateUtility.IsWithinRange(eventStartDate, currDate, eventEndDate) ? Color.DarkBlue : Color.DarkRed); User_Title.SetText(@event.Title); User_Comment.SetText(!string.IsNullOrEmpty(@event.Comment) ? @event.Comment : NO_COMMENT); }
public void delete(int id) { User_Comment uComment = this.context.User_Comment.SingleOrDefault(x => x.Id == id); this.context.User_Comment.Remove(uComment); this.context.SaveChanges(); }
public void Update(User_Comment User_Comment) { User_Comment uComment = this.context.User_Comment.SingleOrDefault(x => x.Id == User_Comment.Id); uComment.commentContent = User_Comment.commentContent; this.context.SaveChanges(); }
public IHttpActionResult GetUser_Comment(int id) { User_Comment user_Comment = db.User_Comment.Find(id); if (user_Comment == null) { return(NotFound()); } return(Ok(user_Comment)); }
public IHttpActionResult PostUser_Comment(User_Comment user_Comment) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.User_Comment.Add(user_Comment); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = user_Comment.Id }, user_Comment)); }
public IHttpActionResult DeleteUser_Comment(int id) { User_Comment user_Comment = db.User_Comment.Find(id); if (user_Comment == null) { return(NotFound()); } db.User_Comment.Remove(user_Comment); db.SaveChanges(); return(Ok(user_Comment)); }
private void ClearEventDetails() { Exp_Start_Date.SetText(DASH); Exp_Start_Time.SetText(DASH); Exp_End_Date.SetText(DASH); Exp_End_Time.SetText(DASH); Created_Date.SetText(DASH); Completion_Date.SetText(DASH); User_Title.SetText(DASH); Event_Status.SetText(DASH); Event_Status.SetBackColor(Color.DarkGray); User_Comment.SetText(NO_COMMENT); }
public ActionResult newComment() { if (Request.Form["commentName"] != null) { User_Comment cmnt = new User_Comment(); cmnt.commentContent = Request.Form["commentContent"]; cmnt.postID = Convert.ToInt32(Request.Form["postId"]); cmnt.userID = Convert.ToInt32(Request.Form["userId"]); cmnt.commentDate = DateTime.Now.Date; comments.Insert(cmnt); return(RedirectToAction("PostDetails", "BlogHome", new { id = Convert.ToInt32(Request.Form["postId"]) })); } return(View()); }
public void Update(User_Comment User_Comment) { this.data.Update(User_Comment); }
public void Insert(User_Comment User_Comment) { this.data.Insert(User_Comment); }
public void Insert(User_Comment User_Comment) { this.context.User_Comment.Add(User_Comment); this.context.SaveChanges(); }