예제 #1
0
 public HttpResponseMessage GetDepartmentByCompanyId(int CompanyId)
 {
     if (CompanyId != null)
     {
         var dept = _departmentServices.GetDepartmentByCompanyId(CompanyId);
         if (dept != null)
         {
             return(Request.CreateResponse(HttpStatusCode.OK, dept));
         }
         throw new ApiDataException(1001, "No Department found for this id.", HttpStatusCode.NotFound);
     }
     throw new ApiException()
           {
               ErrorCode        = (int)HttpStatusCode.BadRequest,
               ErrorDescription = "Bad Request..."
           };
 }