public HttpResponseMessage GetEmpByCompanyAndDivision(String company, String division, String keyStroke)
        {
            //Get all area
            List <EmpId> listEmpId = EmpId.getEmpByCompanyList(company, division, keyStroke);
            var          jsonNew   = new
            {
                result = listEmpId
            };

            return(Request.CreateResponse(HttpStatusCode.OK, jsonNew));
        }
        public HttpResponseMessage Get()
        {
            //Get all area
            List <EmpId> listEmpId = EmpId.getAllEmpIdList();
            var          jsonNew   = new
            {
                result = listEmpId
            };

            return(Request.CreateResponse(HttpStatusCode.OK, jsonNew));
        }
예제 #3
0
 public override string ToString()
 {
     return(EmpId.ToString() + " - " + Nombre.ToString());
 }
예제 #4
0
        public HttpResponseMessage UploadImage()
        {
            string ImageName = null;
            int    EmpId;
            var    httpRequest = HttpContext.Current.Request;
            var    PostedFile  = httpRequest.Files["Image"];

            ImageName = new string(Path.GetFileNameWithoutExtension(PostedFile.FileName).Take(10).ToArray()).Replace(" ", "_");
            ImageName = ImageName + DateTime.Now.ToString("yymmssfff") + Path.GetExtension(PostedFile.FileName);
            var filePath = HttpContext.Current.Server.MapPath("~/Image/" + ImageName);

            PostedFile.SaveAs(filePath);
            EmpId = Convert.ToInt32(httpRequest["EmployeeId"]);

            using (OVODEntities entities = new OVODEntities())
            {
                var entity = entities.ANG_EMPLOYEE.FirstOrDefault(e => e.id == EmpId);
                if (entity == null)
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Employee id: " + EmpId.ToString() + " not found to update."));
                }
                else
                {
                    entity.PhotoPath = ImageName;
                    entities.SaveChanges();
                    return(Request.CreateResponse(HttpStatusCode.Created));
                }
            }
        }