Esempio n. 1
0
        // GET: Cliente/Details/5
        public ActionResult Details(int id)
        {
            var Employee          = _employeeApp.GetById(id);
            var EmployeeViewModel = Mapper.Map <Employee, EmployeeViewModel>(Employee);

            return(View(EmployeeViewModel));
        }
Esempio n. 2
0
        public IHttpActionResult GetForIds(List <long> staffIds)
        {
            try
            {
                var leaveRequestDtos   = _leaveRequestAppService.GetForIds(staffIds);
                var leaveRequestModels = new List <LeaveRequestModel>();

                foreach (var leaveRequestDto in leaveRequestDtos)
                {
                    leaveRequestModels.Add(Mapper.Map <LeaveRequestModel>(leaveRequestDto));
                }

                foreach (var leaveRequestModel in leaveRequestModels)
                {
                    if (leaveRequestModel.EmployeeId != null)
                    {
                        var employeeDto = _employeeAppService.GetById((long)leaveRequestModel.EmployeeId);
                        var user        = _userAppService.GetById(employeeDto.UserId);

                        leaveRequestModel.StaffName = user.Firstname + " " + user.Lastname;
                    }
                }

                return(Ok(leaveRequestModels));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
        // GET: Employee/Edit/5
        public ActionResult Edit(Guid id)
        {
            var model = _employeeAppService.GetById(id);

            ViewBag.role = new SelectList(_roleAppService.GetAll(), "RoleId", "Name", model.RoleId);

            var depentents = model.Dependents.Select(dep => new DependentDto
            {
                Id   = dep.DependentId,
                Nome = dep.Name
            }).ToList();

            ViewBag.Dependent = depentents;
            Session.Add("DEPENDENT", depentents);


            return(View(model));
        }
Esempio n. 4
0
        public IHttpActionResult GetById(long id)
        {
            try
            {
                var employeeDto   = _employeeAppService.GetById(id);
                var employeeModel = Mapper.Map <EmployeeModel>(employeeDto);

                return(Ok(employeeModel));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
        public HttpResponseMessage GetEmployeeById(long id)
        {
            if (id != 0)
            {
                var employee = _employeeAppService.GetById(id);
                if (employee != null)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, employee));
                }

                throw new ApiDataException(1001, "No product found for this id.", HttpStatusCode.NotFound);
            }
            throw new ApiException()
                  {
                      ErrorCode = (int)HttpStatusCode.BadRequest, ErrorDescription = "Bad Request..."
                  };
        }
Esempio n. 6
0
        public async Task <IActionResult> Get(int id)
        {
            var employeeViewModel = _employeeAppService.GetById(id);

            return(await Response(employeeViewModel));
        }
Esempio n. 7
0
        public async Task <IActionResult> Get(Guid id)
        {
            var data = await _employeeAppService.GetById(id);

            return(Ok(data));
        }
        public IActionResult Get(Guid id)
        {
            var employeeViewModel = _employeeAppService.GetById(id);

            return(Response(employeeViewModel));
        }
Esempio n. 9
0
 public EmployeeViewModel Get(Guid id)
 {
     return(_employeeAppService.GetById(id));
 }