Exemplo n.º 1
0
        public IHttpActionResult RegisterEmployeeInPosition(EmployeeInPositionVM m)
        {
            m.Employee.Id = m.EmployeeId;
            m.Position.Id = m.PositionId;
            var eip = _servicePosition.RegisterEmployeeInPosition(m.EmployeeId, m.PositionId, m.Active);

            return(Ok(m));
        }
 public IHttpActionResult Delete(EmployeeInPositionVM m)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     _servicePosition.Delete(m.Id);
     return(Ok());
 }
        public IHttpActionResult RegisterEmployeeInPosition(EmployeeInPositionVM m)
        {
            m.Employee.Id = m.EmployeeId;
            m.Position.Id = m.PositionId;
            var eip = _servicePosition.RegisterEmployeeInPosition(m.EmployeeId, m.PositionId, m.Active);

            m.Id = eip.Id;
            m.Employee.FirstName = eip.Employee.Firstname;
            m.Employee.LastName  = eip.Employee.Lastname;
            m.Position.Name      = eip.Position.Name;

            return(Created <EmployeeInPositionVM>(Request.RequestUri + m.Id.ToString(), m));
        }
Exemplo n.º 4
0
        public IHttpActionResult Update(EmployeeInPositionVM m)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            m.Employee.Id = m.EmployeeId;
            m.Position.Id = m.PositionId;

            _servicePosition.Update(m.Id, m.EmployeeId, m.PositionId, m.Active);
            //_servicePosition.Update(m);
            return(Ok(m));
        }