Exemple #1
0
        private string updateInfor(UInforRequest request)
        {
            //{"empId":"4","birthday":"1998-06-05"}
            //{"empId":"4","phone":"0826186206"}
            //{"empId":"4","address":"11/55d kp3 ptam hoa bien hoa dong nai"}
            int      id      = request.id;
            DateTime?birth   = request.birth;
            string   phone   = request.phone;
            string   address = request.address;

            if (birth != null)
            {
                var res = updateInfoOfEmp(id, "birthday", Convert.ToString(birth));
                return(res);
            }
            else if (phone != null)
            {
                var res = updateInfoOfEmp(id, "phone", phone);
                return(res);
            }
            else if (address != null)
            {
                var res = updateInfoOfEmp(id, "address", address);
                return(res);
            }
            else
            {
                return(null);
            }
        }
        public async Task <ActionResult> updateInfEmp([FromQuery] UInforRequest request)
        {
            ActionResult response = null;
            //
            InformationService service = new InformationService(_unitOfWork);
            var res = service.updateInformationEmpById(request);

            //
            switch (res)
            {
            case "notFound":
                response = NotFound(); break;

            case "failed":
                response = BadRequest(); break;

            case "success":
                response = Ok(service.getInformationEmpById(request.id)); break;

            case null:
                response = BadRequest(); break;
            }
            return(await Task.FromResult(response));
        }
Exemple #3
0
 public string updateInformationEmpById(UInforRequest value)
 {
     return(updateInfor(value));
 }