Ejemplo n.º 1
0
 public string insertTest(Accessory row)
 {
     if (accessoryDAO.Insert(Database.getAccessoryName(), row))
     {
         return("SUCCESS");
     }
     return("FAIL");
 }
        public IActionResult InsertAcc([FromBody] DTO.AccessoryJSON acc)
        {
            Accessory dto = new Accessory
            {
                AccId             = acc.AccId,
                AccName           = acc.AccName,
                AccCatId          = acc.AccCatId,
                Brand             = acc.Brand,
                Description       = acc.Description,
                Price             = Double.Parse(acc.Price),
                StartSellingDate  = DateTime.Parse(acc.StartSellingDate),
                Image             = acc.Image,
                AvailableQuantity = int.Parse(acc.AvailableQuantity),
                SalePercent       = double.Parse(acc.SalePercent),
                IsDelete          = false
            };
            AccessoryDAO dao    = new AccessoryDAO(_context);
            bool         result = dao.Insert(dto);

            return(new JsonResult(result));
        }