public IActionResult ChangeProfile(ProfileFullView view)
        {
            var mapConfig         = new MapperConfiguration(cfg => cfg.CreateMap <ProfileFullView, Profile>());
            var mapper            = new Mapper(mapConfig);
            var resultFromHandler = requestHandler.Change(view.Id.Value, mapper.Map <Profile>(view)); // проверка на null?

            return(ApiResultGenerator.GenerateResult(resultFromHandler));
        }
        public IActionResult CreateProfile(ProfileFullView view)
        {
            var mapConfig         = new MapperConfiguration(cfg => cfg.CreateMap <ProfileFullView, Profile>());
            var mapper            = new Mapper(mapConfig);
            var resultFromHandler = requestHandler.Add(mapper.Map <Profile>(view));

            return(ApiResultGenerator.GenerateResult(resultFromHandler));
        }
        public IActionResult GetProfile(Guid id)
        {
            var mapConfig         = new MapperConfiguration(cfg => cfg.CreateMap <Profile, ProfileFullView>());
            var mapper            = new Mapper(mapConfig);
            var resultFromHandler = requestHandler.Get(id);

            return(ApiResultGenerator.GenerateResult(resultFromHandler.BuildWithChangeData(f => mapper.Map <ProfileFullView>(f))));
        }
        public IActionResult GetFreeEmployeesList()
        {
            var mapConfig         = new MapperConfiguration(cfg => cfg.CreateMap <Employee, EmployeeShortView>());
            var mapper            = new Mapper(mapConfig);
            var resultFromHandler = requestHandler.GetFreeEmployees();

            return(ApiResultGenerator.GenerateResult(resultFromHandler.BuildWithChangeData(l => l.Select(e => mapper.Map <EmployeeShortView>(e)).ToList())));
        }
        public IActionResult GetEmployeesWithProfiles(int startIndex = 0, int itemsCount = 10)
        {
            var requestResult = requestHandler.GetEmployeesWithProfiles(startIndex, itemsCount);

            return(ApiResultGenerator.GenerateResult
                       (requestResult.BuildWithChangeData(l => new ViewListElements <EmployeeProfileShortView>
            {
                Items = l.Item2.Select(a => a.ToEmployeeProfileShortView()).ToList(), ItemsCount = l.itemsCount
            })));
        }
        public IActionResult GetProfiles(int startIndex = 0, int itemsCount = 10)
        {
            var mapConfig         = new MapperConfiguration(cfg => cfg.CreateMap <Profile, ProfileFullView>());
            var mapper            = new Mapper(mapConfig);
            var resultFromHandler = requestHandler.GetRange(startIndex, itemsCount);

            return(ApiResultGenerator.GenerateResult
                       (resultFromHandler.BuildWithChangeData(l => new ViewListElements <ProfileFullView>
            {
                Items = mapper.Map <List <ProfileFullView> >(l.items), ItemsCount = l.itemsCount
            })));
        }
        public IActionResult DeleteProfile(Guid id)
        {
            var resultFromHandler = requestHandler.Delete(id);

            return(ApiResultGenerator.GenerateResult(resultFromHandler));
        }
 public IActionResult ChangleEmployeeWithProfile(EmployeeProfileFullView view)
 {
     return(ApiResultGenerator.GenerateResult(requestHandler.ChangeEmployeeWithProfile(view.ToProfileWithEmployee())));
 }
 public IActionResult DeleteEmployeeWithProfile(Guid id)
 {
     return(ApiResultGenerator.GenerateResult(requestHandler.DeleteEmployeeWithProfile(id)));
 }
 public IActionResult GetEmployeeWithProfile(Guid id)
 {
     return(ApiResultGenerator.GenerateResult
                (requestHandler.GetEmployeeWithProfile(id).BuildWithChangeData(p => p.ToEmployeeProfileFullView())));
 }