public IActionResult Update(long id, [FromBody] AssignmentListItem item) { if (item == null || item.Id != id) { return(BadRequest()); } var AssignmentList = _context.AssignmentListItems.FirstOrDefault((t => t.Id == id)); if (AssignmentList == null) { return(NotFound()); } AssignmentList.IsComplete = item.IsComplete; AssignmentList.ProjectCode = item.ProjectCode; AssignmentList.Name = item.Name; AssignmentList.ProjectDesc = item.ProjectDesc; AssignmentList.IsComplete = item.IsComplete; AssignmentList.LabLocation = item.LabLocation; AssignmentList.BillTo = item.BillTo; AssignmentList.ReportTo = item.ReportTo; AssignmentList.AEName = item.AEName; AssignmentList.JDECode = item.JDECode; AssignmentList.PercentOfProject = item.PercentOfProject; AssignmentList.LoginsAssociated = item.LoginsAssociated; AssignmentList.DollarValue = item.DollarValue; AssignmentList.Status = item.Status; _context.AssignmentListItems.Update(AssignmentList); _context.SaveChanges(); return(new NoContentResult()); }
public IActionResult Create([FromBody] AssignmentListItem item) { //The[FromBody] attribute tells MVC to get the value of the to-do item from the body of the HTTP request. if (item == null) { return(BadRequest()); } _context.AssignmentListItems.Add(item); _context.SaveChanges(); return(CreatedAtRoute("GetAssignmentList", new { id = item.Id }, item)); }
public async void changeIsDoneState(object sender, EventArgs e) { AssignmentListItem assignment = (AssignmentListItem)((MenuItem)sender).CommandParameter; if (assignment.id != 0) { if (assignment.isDone == true) { await this.model.undoMarkAssignmentDone(assignment.id, studentId); } else if (assignment.isDone == false) { await this.model.markAssignmentDone(assignment.id, studentId); } } }
public StudentAssignmentViewCellData( AssignmentListItem assignment, StudentAssignmentListView list ) { this.list = list; this.assignment = assignment; this.assignment_name = assignment.name; this.dueDate = assignment.dueDate; this.assignment_id = assignment.id; this.classRoom = assignment.classRoom; this.markedDone = assignment.isDone; int dueDateResult = DateTime.Compare(this.dueDate, DateTime.Now); if (dueDateResult > 0 && this.markedDone == true) { this.doneColor = "#66ff66"; this.isDone = "Undo"; } else if (dueDateResult <= 0 && this.markedDone == false) { this.doneColor = "#ff0000"; this.isDone = "Mark Done"; } else if (dueDateResult > 0 && this.markedDone == false) { this.doneColor = "#3399ff"; this.isDone = "MarkDone"; } }