public async Task <TaskModels <R> > WaitForTaskComplete <R>(string taskId) { string url = ApiEndpoint + @"/v2/tasks/" + taskId; TaskModels <R> taskModel = new TaskModels <R>(); bool completed = false; do { var response = await WebRequests.GetAsync(url, AccessToken); if (response.StatusCode == System.Net.HttpStatusCode.OK) { taskModel = await RetrieveTask <R>(response); } if (taskModel.data?.status == "error" || taskModel.data?.status == "finished") { completed = true; } else { await Task.Delay(TimeSpan.FromSeconds(1)); } } while (!completed); return(taskModel); }
private async Task <TaskModels <TaskFileResultModels> > RetrieveTask(HttpResponseMessage response, TaskModels <TaskFormResultModels> taskModelWithForm) { var taskModelWithFiles = new TaskModels <TaskFileResultModels>(); taskModelWithFiles.data = new TaskDataModels <TaskFileResultModels>(taskModelWithForm.data); taskModelWithFiles.data.result = new TaskFileResultModels(); var responseString = await response.Content.ReadAsStringAsync(); if (!string.IsNullOrEmpty(responseString)) { XmlDocument doc = new XmlDocument(); doc.LoadXml(responseString); string json = JsonConvert.SerializeXmlNode(doc); var cloudConvertStorageModels = JsonConvert.DeserializeObject <ImportCloudConvertStorageModels>(json); taskModelWithFiles.data.result.files = new TaskFileModels[] { new TaskFileModels { filename = cloudConvertStorageModels.PostResponse.Key.Replace($"{taskModelWithFiles.data.id}/", ""), md5 = cloudConvertStorageModels.PostResponse.ETag, url = cloudConvertStorageModels.PostResponse.Location } }; } return(taskModelWithFiles); }
public JsonResult GetTastDetails(int id) { TaskModels taskmodle = new TaskModels(); taskmodle = _db.Task.Where(c => c.TaskId == id).SingleOrDefault(); return(Json(taskmodle)); //return View(); }
public ActionResult Edit(TaskModels taskModels) { if (ModelState.IsValid) { _taskService.Update(taskModels.ToEntity()); return(RedirectToAction("Index")); } return(View(taskModels)); }
public async Task <TaskModels <R> > RetrieveTask <R>(HttpResponseMessage response) { TaskModels <R> taskModel = new TaskModels <R>(); var responseString = await response.Content.ReadAsStringAsync(); if (!string.IsNullOrEmpty(responseString)) { taskModel = JsonConvert.DeserializeObject <TaskModels <R> >(responseString); } return(taskModel); }
public ActionResult UserDashBoardIndex() { UserAssignedTask taskmodle = new UserAssignedTask(); List <UserAssignedTask> taskmodleList = new List <UserAssignedTask>(); //dynamic taskmodle = new UserAssignedTask(); TaskModels taskmodle1 = new TaskModels(); EmployeeDetailsContext _db = new EmployeeDetailsContext(); // int fileId=_db. ApplicationUser user = System.Web.HttpContext.Current.GetOwinContext().GetUserManager <ApplicationUserManager>().FindById(System.Web.HttpContext.Current.User.Identity.GetUserId()); var UserGuid = user.Id; var adminRoleID = Guid.Parse(user.Id); // taskmodle = _db.UserAssignedTask.Where(c => c.LogedInUserGuid.Equals(user.Id)).SingleOrDefault(); taskmodle = _db.UserAssignedTask.Where(c => c.LogedInUserGuid == adminRoleID).FirstOrDefault(); int taskid = taskmodle.TaskId; string loggedInUserName = taskmodle.UserName; taskmodleList = _db.UserAssignedTask.Where(c => c.UserName == loggedInUserName).ToList(); ViewBag.FileId = taskmodle1.FileId; return(View(taskmodle)); }
public JsonResult UserDashBoardIndex1() { UserAssignedTask taskmodle = new UserAssignedTask(); List <UserAssignedTask> taskmodleList = new List <UserAssignedTask>(); //dynamic taskmodle = new UserAssignedTask(); TaskModels taskmodle1 = new TaskModels(); EmployeeDetailsContext _db = new EmployeeDetailsContext(); // int fileId=_db. ApplicationUser user = System.Web.HttpContext.Current.GetOwinContext().GetUserManager <ApplicationUserManager>().FindById(System.Web.HttpContext.Current.User.Identity.GetUserId()); var UserGuid = user.Id; var adminRoleID = Guid.Parse(user.Id); // taskmodle = _db.UserAssignedTask.Where(c => c.LogedInUserGuid.Equals(user.Id)).SingleOrDefault(); taskmodle = _db.UserAssignedTask.Where(c => c.LogedInUserGuid == adminRoleID).FirstOrDefault(); int taskid = taskmodle.TaskId; string loggedInUserName = taskmodle.UserName; taskmodleList = _db.UserAssignedTask.Where(c => c.UserName == loggedInUserName).ToList(); int taskid1 = 0; int fileId1; foreach (var c in taskmodleList) { taskid1 = c.TaskId; var query = from st in _db.Task where st.FileId == taskid1 select st.FileId; //var student = query.SingleOrDefault<TaskModels>(); c.FileID = query.FirstOrDefault(); // fileId1 = _db.Task.Where(s => s.FileId == taskid1).FirstOrDefault(); } ViewBag.FileId = taskmodle1.FileId; return(Json(taskmodleList, JsonRequestBehavior.AllowGet)); //return View(taskmodle); }
public ActionResult TaskCreation(TaskModels task) { _db.Task.Add(task); _db.SaveChanges(); return(View()); }