public ActionResult AssignUser(string id = "", string jobindexguid = "") { Logger.Debug("Inside Job Controller- Index"); try { if (Session["OrganizationGUID"] != null) { if (!string.IsNullOrEmpty(id) && !string.IsNullOrEmpty(jobindexguid)) { Job _job = new Job(); _job.JobGUID = new Guid(jobindexguid); _job.AssignedUserGUID = new Guid(id); _job.LastModifiedDate = DateTime.UtcNow; _job.LastModifiedBy = new Guid(Session["UserGUID"].ToString()); int result = _IJobRepository.AssignJob(_job); if (result > 0) { Job job = _IJobRepository.GetJobByID(_job.JobGUID); if (job != null) { JobAssigned _jobAssigned = new JobAssigned(); _jobAssigned.JobAssignGUID = Guid.NewGuid(); _jobAssigned.JobGUID = job.JobGUID; _jobAssigned.UserGUID = job.AssignedUserGUID; _jobAssigned.StartTime = job.ScheduledEndTime; _jobAssigned.EndTime = job.ScheduledEndTime; _jobAssigned.Latitude = job.Latitude; _jobAssigned.Longitude = job.Longitude; _jobAssigned.LastModifiedDate = DateTime.UtcNow; _jobAssigned.LastModifiedBy = new Guid(Session["UserGUID"].ToString()); _IJobRepository.InsertJobAssigned(_jobAssigned); //_IJobRepository.Save(); } } // _IJobRepository.AssignUser(new Guid(id), new Guid(jobindexguid)); } return(RedirectToAction("Index", "JobStatus")); } else { return(RedirectToAction("SessionTimeOut", "User")); } } catch (Exception ex) { Logger.Error(ex.Message); return(RedirectToAction("../User/Login")); } }