コード例 #1
0
        // DELETE api/users/5
        public async Task <HttpResponseMessage> Delete(int id)
        {
            try
            {
                var userToDelete = m_userRepository.Get(id);
                if (userToDelete == null)
                {
                    // we already have a user with this ID
                    return(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                    {
                        ReasonPhrase = "User with this ID doesn't exist."
                    });
                }

                await m_userRepository.DeleteById(id);

                return(new HttpResponseMessage(HttpStatusCode.OK));
            }
            catch (Exception ex)
            {
                return(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    ReasonPhrase = $"Something went wrong when trying to remove the user. ({ex.Message})"
                });
            }
        }
コード例 #2
0
        public ActionResult ProjectJiraDestroy([DataSourceRequest] DataSourceRequest request, ProjectJiraViewModel prjJira)
        {
            if (prjJira != null)
            {
                var jiraId = (from data in _dbContext.TlfmsJiraLink
                              where data.Id == prjJira.Id
                              select data.Id).FirstOrDefault();

                _objProjectJira.DeleteById(jiraId);
            }
            return(Json(new[] { prjJira }.ToDataSourceResult(request, ModelState)));
        }
コード例 #3
0
        public ActionResult ProjectActivityDestroy([DataSourceRequest] DataSourceRequest request, ProjectActivityViewModel prjActview)
        {
            if (prjActview != null)
            {
                var prjActivityId = (from data in _dbContext.ProjectActivityLink
                                     where data.Id == prjActview.Id
                                     select data.Id).FirstOrDefault();

                _objProjectActivity.DeleteById(prjActivityId);
            }
            return(Json(new[] { prjActview }.ToDataSourceResult(request, ModelState)));
        }
コード例 #4
0
        public ActionResult ProjectPhaseDestroy([DataSourceRequest] DataSourceRequest request, ProjectPhaseViewModel phaseview)
        {
            if (phaseview != null)
            {
                var prjTeamId = (from data in _dbContext.ProjectPhases
                                 where data.Id == phaseview.Id
                                 select data.Id).FirstOrDefault();

                _objProjectPhase.DeleteById(prjTeamId);
            }
            return(Json(new[] { phaseview }.ToDataSourceResult(request, ModelState)));
        }
コード例 #5
0
        public ActionResult ProjectCRsDestroy([DataSourceRequest] DataSourceRequest request, ProjectJiraViewModel prjJcr)
        {
            if (prjJcr != null)
            {
                var crId = (from data in _dbContext.ProjectCR
                            where data.CRId == prjJcr.Id
                            select data.CRId).FirstOrDefault();

                _objProjectCRs.DeleteById(crId);
            }
            return(Json(new[] { prjJcr }.ToDataSourceResult(request, ModelState)));
        }
コード例 #6
0
        public ActionResult ProjectTeamDestroy([DataSourceRequest] DataSourceRequest request, ProjectTeamsViewModel prjview)
        {
            if (prjview != null)
            {
                //Find SLA id
                var prjTeamId = (from data in _dbContext.ProjectTeam
                                 where data.Id == prjview.Id
                                 select data.Id).FirstOrDefault();

                _objProjectTeam.DeleteById(prjTeamId);
            }
            return(Json(new[] { prjview }.ToDataSourceResult(request, ModelState)));
        }
コード例 #7
0
        public ActionResult ProjectDemandDestroy([DataSourceRequest] DataSourceRequest request, ProjectResourceDemand prjDemand)
        {
            if (prjDemand != null)
            {
                //Find SLA id
                var prjDemandId = (from data in _dbContext.ProjectResourceDemand
                                   where data.Id == prjDemand.Id
                                   select data.Id).FirstOrDefault();

                _objProjectDemand.DeleteById(prjDemandId);
            }
            return(Json(new[] { prjDemand }.ToDataSourceResult(request, ModelState)));
        }