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"); } }
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()); } }
public string Post([FromBody] FoodSell value) { _context.FoodSells.Add(value); _context.SaveChanges(); return("Successfully Sell Details Added"); }