public void Post([FromBody] PinnedDeal pinnedDeal) { int dealId = pinnedDeal.DealId; string userId = pinnedDeal.UserId; if (_db.PinnedDeals.Where(entry => entry.DealId == dealId).Where(entry => entry.UserId == userId).ToList().Count() == 0) { _db.PinnedDeals.Add(pinnedDeal); } _db.SaveChanges(); }
public void Post([FromBody] Deal deal) { DateTime currentTime = new DateTime(); currentTime = DateTime.Now; deal.TimeUpdated = currentTime; _db.Deals.Add(deal); if (deal.UserId != null) { _db.PostedDeals.Add(new PostedDeal() { UserId = deal.UserId, DealId = deal.DealId }); } _db.SaveChanges(); }
public void Post(string userId, [FromBody] PostedDeal postedDeal) { _db.PostedDeals.Add(postedDeal); _db.SaveChanges(); }
public void Post([FromBody] Location location) { _db.Locations.Add(location); _db.SaveChanges(); }
public void Post([FromBody] User user) { _db.Users.Add(user); _db.SaveChanges(); }
public void Post([FromBody] Item item) { _db.Items.Add(item); _db.SaveChanges(); }