public PartialViewResult Edit(TicketBase tick,string Id) { ObjectId tickId; var isValid = ObjectId.TryParse(Id, out tickId); if (isValid) { var _tickets = mongoDatabase.GetCollection<TicketBase>("TicketBase"); var getQuery = Query<TicketBase>.EQ(e => e.Id, tickId); var existingtick = _tickets.FindOne(getQuery); existingtick.AssignedToId = tick.AssignedToId; existingtick.CloseDate = tick.CloseDate; existingtick.CreateDate = tick.CreateDate; existingtick.CreatedBy = tick.CreatedBy; existingtick.Issue = tick.Issue; existingtick.PercentComplete = tick.PercentComplete; existingtick.ProjectName = tick.ProjectName; existingtick.Remarks = tick.Remarks; existingtick.Status = tick.Status; _tickets.Save(existingtick); return GetAll(); } else { return PartialView("Error"); } }
public PartialViewResult Create(TicketBase tick) { if (ModelState.IsValid) { var _tickets = mongoDatabase.GetCollection<TicketBase>("TicketBase"); _tickets.Insert(tick); var id = tick.Id; return GetAll(); } else { return PartialView("Error"); } }