public async Task <IHttpActionResult> Create([FromBody] ConsultantAddDto consultantAddDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            if (consultantAddDto.UserAddDto == null)
            {
                return(BadRequest("User can not be null"));
            }
            consultantRepository.Create(consultantAddDto.ConsultantAddDtoToConsultant());
            await db.SaveChangesAsync();

            return(Ok());
        }
Ejemplo n.º 2
0
 public static Consultant ConsultantAddDtoToConsultant(this ConsultantAddDto consultantAddDto)
 {
     if (consultantAddDto != null)
     {
         return(new Consultant
         {
             Id = 0,
             Level = consultantAddDto.Level,
             Manager = null,
             ManagerId = consultantAddDto.ManagerId,
             Project = null,
             UserId = null,
             ProjectId = consultantAddDto.ProjectId,
             SkillsFile = consultantAddDto.SkillsFile,
             User = consultantAddDto.UserAddDto.UserAddDtoToUser()
         });
     }
     return(null);
 }