Esempio n. 1
0
        public dynamic Putstaff(long id, [FromBody] StaffRequestDto staffDto)
        {
            String authen_token = null;

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != staffDto.id)
            {
                return(BadRequest());
            }

            try
            {
                authen_token = staffRepository.updateStaff(id, staffDto);
            }
            catch (Exception e)
            {
                if (!staffRepository.staffExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw e;
                }
            }

            return(Ok(authen_token));
        }