Esempio n. 1
0
        public string Post(FoodSell obj)
        {
            //  _log4net.Info(" Http POST Request done");
            var ob = _context.FoodItems.Where(x => x.FoodId == obj.FoodItemId).FirstOrDefault();

            if (ob != null && obj.Quantity > 0)
            {
                _context.FoodSells.Add(obj);
                _context.SaveChanges();
                return("Success");
            }
            else
            {
                return("Food is not present in main table");
            }
        }
Esempio n. 2
0
        public IActionResult Post([FromBody] FoodSell value)
        {
            /* _context.FoodSells.Add(value);
             * _context.SaveChanges();
             * return "Successfully Sell Details Added"; */
            //  return _context.Post(value);
            string s = "Success";

            if (_context.Post(value) == s)
            {
                return(Ok());
            }
            else
            {
                return(BadRequest());
            }
        }
Esempio n. 3
0
 public string Post([FromBody] FoodSell value)
 {
     _context.FoodSells.Add(value);
     _context.SaveChanges();
     return("Successfully Sell Details Added");
 }