public GetCategorityResponse LoadCategory([FromBody] LetterMenu menu) { GetCategorityResponse response = new GetCategorityResponse(); try { var list = _repository.GetCategorys(menu.Id); string c = list[0].Name; if (list != null) { Mapper.CreateMap <Category, ViewCategoritys>(); var res = Mapper.Map <List <Category>, List <ViewCategoritys> >(list); Mapper.AssertConfigurationIsValid(); response.Categoritys = res; } return(response); } catch (Exception ex) { response.Code = 1; response.Message = ex.Message; } return(response); }
public GetCategorityResponse GetCategory() { GetCategorityResponse response = new GetCategorityResponse(); try { var list = _repository.GetCategorys(); if (list != null) { Mapper.CreateMap <Category, ViewCategoritys>(); var res = Mapper.Map <List <Category>, List <ViewCategoritys> >(list); Mapper.AssertConfigurationIsValid(); response.Categoritys = res; } return(response); } catch (Exception ex) { response.Code = 1; response.Message = ex.Message; } return(response); }