public async Task<IHttpActionResult> Post(int UserId, BugReportingModel oBugReport) { string sIPAddress = Request.GetOwinContext().Request.RemoteIpAddress; try { User oUser = await oUserRepo.GetUser(UserId); string sCustomerName = oUser.FirstName + " " + oUser.LastName; oBugReport.bug_reporter_name = sCustomerName; oInsTaskHandler.CreateBugFixTask(oBugReport); oLogger.LogData("ROUTE: api/BugReport/{UserId}; METHOD: POST; IP_ADDRESS: " + sIPAddress); return Ok(); } catch(Exception ex) { oLogger.LogData("ROUTE: api/BugReport/{UserId}; METHOD: GET; IP_ADDRESS: " + sIPAddress + "; EXCEPTION: " + ex.Message + "; INNER EXCEPTION: " + ex.InnerException); return InternalServerError(); } }
public Task CreateBugFixTask(BugReportingModel oBugReport) { InsightlyService i = new InsightlyService(sInsightlyApiKey); Task oInsightlyTask = new Task(); oInsightlyTask.Status = "Not Started"; oInsightlyTask.Priority = 3; oInsightlyTask.OwnerUserId = 1507578; oInsightlyTask.Title = "Bug Report From EmediCodes User: " + oBugReport.bug_reporter_name; oInsightlyTask.StartDate = DateTime.Now; oInsightlyTask.PubliclyVisible = true; oInsightlyTask.DueDate = DateTime.Now.AddDays(7); oInsightlyTask.Details = oBugReport.bug_description; oInsightlyTask.Completed = false; oInsightlyTask.OwnerVisible = true; oInsightlyTask.ResponsibleUserId = 1507578; oInsightlyTask.DateCreatedUtc = DateTime.Now; oInsightlyTask.AssignedByUserId = 1507578; i.CreateTask(oInsightlyTask); return(oInsightlyTask); }