Exemplo n.º 1
0
        public void Should_Success_MapToModel()
        {
            GarmentCategoryViewModel model = DataUtil.GetNewData_GarmentCategoryViewModel();
            var Response = Services.MapToModel(model);

            Assert.NotNull(Response);
        }
Exemplo n.º 2
0
        public async Task Post()
        {
            GarmentCategoryViewModel categoryViewModel = GenerateTestModel();
            var response = await this.Client.PostAsync(URI, new StringContent(JsonConvert.SerializeObject(categoryViewModel).ToString(), Encoding.UTF8, "application/json"));

            Assert.Equal(HttpStatusCode.Created, response.StatusCode);
        }
        public GarmentCategoryViewModel GetEmptyData()
        {
            GarmentCategoryViewModel Data = new GarmentCategoryViewModel();

            Data.name            = "";
            Data.codeRequirement = "";
            Data.code            = "";
            Data.uom             = null;
            return(Data);
        }
        public GarmentCategoryViewModel GetNewDataBE()
        {
            long nowTicks = DateTimeOffset.Now.Ticks;

            var data = new GarmentCategoryViewModel
            {
                Code            = "Code123BE",
                CodeRequirement = "BE",
                Name            = "Name123BE",
            };

            return(data);
        }
Exemplo n.º 5
0
        public GarmentCategoryViewModel GetNewData_GarmentCategoryViewModel()
        {
            GarmentCategoryViewModel Data = new GarmentCategoryViewModel();

            Data.name            = "";
            Data.codeRequirement = "";
            Data.categoryType    = "";
            Data.code            = "";
            Data.UOM             = new GarmentCategoryUomViewModel()
            {
                Unit = ""
            };
            return(Data);
        }
Exemplo n.º 6
0
        public GarmentCategoryViewModel MapToViewModel(GarmentCategory category)
        {
            GarmentCategoryViewModel categoryViewModel = new GarmentCategoryViewModel();

            PropertyCopier <GarmentCategory, GarmentCategoryViewModel> .Copy(category, categoryViewModel);

            categoryViewModel.UOM = new GarmentCategoryUomViewModel
            {
                Id   = (int)category.UomId,
                Unit = category.UomUnit
            };
            categoryViewModel.name            = category.Name;
            categoryViewModel.code            = category.Code;
            categoryViewModel.codeRequirement = category.CodeRequirement;
            categoryViewModel.categoryType    = category.CategoryType;

            return(categoryViewModel);
        }
        public GarmentCategory MapToModel(GarmentCategoryViewModel categoryVM)
        {
            GarmentCategory garmentCategory = new GarmentCategory();

            PropertyCopier <GarmentCategoryViewModel, GarmentCategory> .Copy(categoryVM, garmentCategory);

            if (!Equals(categoryVM.uom, null))
            {
                garmentCategory.UomId   = categoryVM.uom.Id;
                garmentCategory.UomUnit = categoryVM.uom.Unit;
            }
            else
            {
                garmentCategory.UomId   = null;
                garmentCategory.UomUnit = null;
            }
            garmentCategory.Name            = categoryVM.name;
            garmentCategory.Code            = categoryVM.code;
            garmentCategory.CodeRequirement = categoryVM.codeRequirement;

            return(garmentCategory);
        }