public async Task <ItemEntity> EditMeetingItemStatusAsync(ItemEntity meetingItemEntity) { var item = _itemRepository.Where(i => i.Id == meetingItemEntity.Id).FirstOrDefault(); item.ItemStatusId = _itemStatusRepository .Where(s => s.Id == meetingItemEntity.ItemStatusId).FirstOrDefault().Id; _itemRepository.Update(item); await _itemRepository.SaveAsync(); var meetingItem = new MeetingItemStatus { ItemId = item.Id, ItemStatusId = item.ItemStatusId, CreatedAt = DateTimeOffset.Now, UpdatedAt = DateTimeOffset.Now }; _meetingItemStatusRepository.Add(meetingItem); await _meetingItemStatusRepository.SaveAsync(); return(new ItemEntity { Id = item.Id, Description = item.Description, DueDate = item.DueDate, UserId = item.UserId, CreatedAt = item.CreatedAt, UpdatedAt = item.UpdatedAt }); }
public IHttpActionResult Post([FromBody] MeetingItemStatus status) { if (status == null) { return(BadRequest("Empty status object sent")); } if (ModelState.IsValid) { using (var entities = new MeetingContext()) { status.dateOfStatusUpdate = DateTime.Now; entities.MeetingItemStatuses.Add(status); try { entities.SaveChanges(); } catch (Exception ex) { return(InternalServerError(ex)); } return(Created("Created", status)); } } else { return(BadRequest(ModelState)); } }
public ActionResult DeleteConfirmed(int id) { MeetingItemStatus meetingitemstatus = _db.MeetingItemStatuses.Find(id); _db.MeetingItemStatuses.Remove(meetingitemstatus); _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "MeetingItemStatusId,PersonId,MeetingId,MeetingItemId,CurrentStatus,ActionRequired,DateUpdated")] MeetingItemStatus meetingitemstatus) { if (ModelState.IsValid) { _db.Entry(meetingitemstatus).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MeetingId = new SelectList(_db.Meetings, "MeetingId", "MeetingDescription", meetingitemstatus.MeetingId); ViewBag.MeetingItemId = new SelectList(_db.MeetingItems, "MeetingItemId", "MeetingItemDescription", meetingitemstatus.MeetingItemId); ViewBag.PersonId = new SelectList(_db.Persons, "PersonId", "FirstName", meetingitemstatus.PersonId); return(View(meetingitemstatus)); }
// GET: /MeetingItemStatus/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MeetingItemStatus meetingitemstatus = _db.MeetingItemStatuses.Find(id); if (meetingitemstatus == null) { return(HttpNotFound()); } return(View(meetingitemstatus)); }
// GET: /MeetingItemStatus/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MeetingItemStatus meetingitemstatus = _db.MeetingItemStatuses.Find(id); if (meetingitemstatus == null) { return(HttpNotFound()); } ViewBag.MeetingId = new SelectList(_db.Meetings, "MeetingId", "MeetingDescription", meetingitemstatus.MeetingId); ViewBag.MeetingItemId = new SelectList(_db.MeetingItems, "MeetingItemId", "MeetingItemDescription", meetingitemstatus.MeetingItemId); ViewBag.PersonId = new SelectList(_db.Persons, "PersonId", "FirstName", meetingitemstatus.PersonId); return(View(meetingitemstatus)); }