コード例 #1
0
        public HttpResponseMessage GetCompany()
        {
            int companyId = 1;
            List <EmployeeDTO> employeelist = service.getCompanyEmployees(companyId);

            return(OOPSResult.OKResult(employeelist));
        }
コード例 #2
0
        public HttpResponseMessage Get()
        {
            int         companyId        = 1;
            int         emplooyeeId      = 3;
            EmployeeDTO selectedEmployee = service.getEmployee(emplooyeeId);

            if (selectedEmployee == null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, emplooyeeId + sysLanguage.CompanyTitlesControllerStrings.id_title));
            }
            return(OOPSResult.OKResult(selectedEmployee));
        }
コード例 #3
0
        public HttpResponseMessage Get()
        {
            List <BloodGroupDTO> bloodGroupList = bloodgroupService.getAll();
            List <AccessTypeDTO> accessTypeList = accessTypeService.getAll();
            StaticTypesViewModel viewModel      = new StaticTypesViewModel()
            {
                bloodGroupList = bloodGroupList,
                accessTypeList = accessTypeList
            };

            return(OOPSResult.OKResult(viewModel));
        }
コード例 #4
0
 public HttpResponseMessage Put(EmployeeDTO employeeDTO)
 {
     try
     {
         EmployeeDTO dto = service.updateEmployee(employeeDTO);
         if (dto != null)
         {
             return(OOPSResult.OKResult(dto, null, HttpStatusCode.OK));
         }
         else
         {
             return(Request.CreateErrorResponse(HttpStatusCode.SeeOther, sysLanguage.CompanyTitlesControllerStrings.update_title));
         }
     }
     catch (Exception)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.SeeOther, sysLanguage.CompanyTitlesControllerStrings.update_title));
     }
 }
コード例 #5
0
 public HttpResponseMessage Post(EmployeeDTO employeeDTO)
 {
     try
     {
         EmployeeDTO dto = service.newEmployee(employeeDTO);
         if (dto != null)
         {
             return(OOPSResult.OKResult(dto, new Uri(Request.RequestUri + "/" + dto.Id), HttpStatusCode.Created));
         }
         else
         {
             return(Request.CreateErrorResponse(HttpStatusCode.SeeOther, sysLanguage.CompanyTitlesControllerStrings.add_title));
         }
     }
     catch (Exception)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.SeeOther, sysLanguage.CompanyTitlesControllerStrings.add_title));
     }
 }