public IActionResult Index()
        {
            var model = new TestInputModel
            {
                Names = new Names
                {
                    FirstName = "Asen",
                    LastName  = "Geshev",
                },
                Email             = "1@1",
                YearsOfExperience = 7,
                DateOfBirth       = new DateTime(1212, 12, 12),
                Egn        = "1234567890",
                University = "SoftUni",
                AllTypes   = positionsService.GetAll(),
            };

            return(PartialView(model));
        }
        public async Task <HttpResponseMessage> Post([FromBody] EmployeeDto employee)
        {
            if (employee != null)
            {
                EmployeeDto temp = new EmployeeDto();

                temp = employee;

                temp.Positions = positionService.GetAll(employee.Positions.Select(x => x.Id).ToArray()).ToArray();
                if (temp.Positions == null)
                {
                    return(new HttpResponseMessage(HttpStatusCode.NotFound));
                }

                EmployeeDto empdto = await employeeService.CreateAsync(temp);

                if (empdto != null && string.IsNullOrEmpty(empdto.Error.TextError))
                {
                    return(new HttpResponseMessage(HttpStatusCode.Created));
                }
            }
            return(new HttpResponseMessage(HttpStatusCode.BadRequest));
        }
Example #3
0
 public IList <PositionDto> Get()
 {
     return(positionService.GetAll());
 }