Exemplo n.º 1
0
        public void AddProduct()
        {
            //string urlSuffix = "api/phone/masterdata/addcategory";
            HttpClient client = Client();

            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            Guid categoryid = Guid.NewGuid();
            CategoryDTO dto = new CategoryDTO()
            {
                Name = Guid.NewGuid().ToString(),
                Id = categoryid,
                IsActive = true,
                AccountId = GetAccountId(),
                Description = "noma",

            };
            var response = client.PostAsJsonAsync("api/phone/masterdata/addcategory", dto);
            var _response = response.Result;

            ProductDTO product = new ProductDTO()
            {
                Name = Guid.NewGuid().ToString(),
                Id = Guid.NewGuid(),
                IsActive = true,
                BuyingPrice = 1,
                SellingPrice = 90,
                AccountId = GetAccountId(),
                CategoryId = categoryid,
                Description = "product web api",

            };
            var response2 = client.PostAsJsonAsync("api/phone/masterdata/addproduct", product);
            var _response2 = response2.Result;
        }
Exemplo n.º 2
0
        public BasicResponse AddCategory(CategoryDTO dto)
        {
            BasicResponse response = new BasicResponse();
               try
               {
               var account = new Category()
               {
                   Name = dto.Name,
                   Id = dto.Id,
                   AccountId = dto.AccountId,
                   Description = dto.Description,

                   IsActive = true,
                   CreatedOn = DateTime.Now,
                   UpdatedOn = DateTime.Now,

               };

               _categoryRepository.Save(account);
               response.Status = true;
               response.Info = "Success";

               }
               catch (Exception ex)
               {

               response.Status = false;
               response.Info = ex.Message;
               }
               return response;
        }
Exemplo n.º 3
0
 public BasicResponse AddCategory(CategoryDTO dto)
 {
     var all = _dataTransferBuilder.AddCategory(dto);
     return all;
 }