public PartialViewResult UpdateMonitor(DevBase monti, string Id)
 {
     if(Id != null)
     {
         var _task = mongoDatabase.GetCollection<Task>("Task");
         var _monitor = mongoDatabase.GetCollection<DevBase>("DevBase");
         var getQuery = Query<DevBase>.EQ(e => e.TaskId, Id);
         var existingmon = _monitor.FindOne(getQuery);
         existingmon.EmpId = monti.EmpId;
         existingmon.TaskId = monti.TaskId;
         existingmon.Status = monti.Status;
         existingmon.AsOnDate = monti.AsOnDate;
         existingmon.CompleteByDate = monti.CompleteByDate;
         existingmon.CompletedDate = monti.CompletedDate;
         existingmon.PercentComplete = monti.PercentComplete;
         existingmon.Remarks = monti.Remarks;
         existingmon.ClientRemarks = monti.ClientRemarks;
         _monitor.Save(existingmon);
         return AddEmployee(monti.TaskId);
     }
     else
     {
         return PartialView("Error");
     }
 }
        public PartialViewResult SaveMonitor(DevBase monti)
        {
            if (ModelState.IsValid)
            {
                var _monitor = mongoDatabase.GetCollection<DevBase>("DevBase");
                var _employee = mongoDatabase.GetCollection<Employee>("Employee");
                var _task = mongoDatabase.GetCollection<Task>("Task");

                ObjectId EmpId;
                var isValid = ObjectId.TryParse(monti.EmpId, out EmpId);
                if (isValid)
                {
                    var getQuery = Query<Employee>.EQ(e => e.EmpId, EmpId);
                    var emp = _employee.FindOne(getQuery);
                    monti.EmpName = emp.Fullname;
                }

                ObjectId taskId;
                isValid = ObjectId.TryParse(monti.TaskId, out taskId);
                if (isValid)
                {
                    var getQuery = Query<Task>.EQ(e => e.TaskId, taskId);
                    var tsk = _task.FindOne(getQuery);
                    monti.TaskName = tsk.Name; 
                }

                _monitor.Insert(monti);
                var id = monti.Id;
                return AddEmployee(monti.TaskId);
            }
            else
            {
                return AddEmployee(monti.TaskId);
            }
        }