public async Task <IActionResult> UpdateIssueTracker(int id, [FromBody] IssueTrackerSaveResource issueTrackerSaveResource)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var issueTracker = await context.IssueTrackers
                               .Include(i => i.IssueType)
                               .Include(d => d.Department)
                               .SingleOrDefaultAsync(it => it.Id == id);

            if (issueTracker == null)
            {
                return(NotFound());
            }

            mapper.Map <IssueTrackerSaveResource, IssueTracker>(issueTrackerSaveResource, issueTracker);

            await context.SaveChangesAsync();

            var issueTracker2 = await context.IssueTrackers
                                .Include(i => i.IssueType)
                                .Include(d => d.Department)
                                .SingleOrDefaultAsync(it => it.Id == id);

            var result = mapper.Map <IssueTracker, IssueTrackerResource>(issueTracker2);

            return(Ok(result));
        }
        public async Task <IActionResult> CreateIssueTracker([FromBody] IssueTrackerSaveResource issueTrackerSaveResource)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var issueTracker = mapper.Map <IssueTrackerSaveResource, IssueTracker>(issueTrackerSaveResource);

            issueTracker.CreateOn = DateTime.Now;
            issueTracker.DueDate  = DateTime.Now.AddDays(2);

            context.IssueTrackers.Add(issueTracker);
            await context.SaveChangesAsync();

            issueTracker = await context.IssueTrackers
                           .Include(i => i.IssueType)
                           .Include(d => d.Department)
                           .SingleOrDefaultAsync(it => it.Id == issueTracker.Id);

            var result = mapper.Map <IssueTracker, IssueTrackerResource>(issueTracker);

            return(Ok(result));
        }