public string Put(int id, grocitem value) { IQueryable <grocitem> obj = _context.grocitems.Where(g => g.GrocId == id); if (obj.Count() > 0) { grocitem obj1 = obj.FirstOrDefault(); obj1.GrocName = value.GrocName; obj1.GrocPrice = value.GrocPrice; obj1.GrocQuantity = value.GrocQuantity; obj1.GrocTime = value.GrocTime; _context.SaveChanges(); return("Congrats!Updated successfully"); } else { return("Enter a Id which already exists!"); } }
public string Put(int id, [FromBody] grocitem value) { return(_context.Put(id, value)); }
public string Post(grocitem obj) { _context.grocitems.Add(obj); _context.SaveChanges(); return("Congrats!Successfully added"); }
public string Post([FromBody] grocitem obj) { _log4net.Info(" Http POST Request done"); return(_context.Post(obj)); }