public bool AddBusket(Basket basket) { if (basket != null) { _db.Baskets.Add(basket); _db.SaveChanges(); return true; } else { return false; } }
// POST api/<controller> public bool Post(Basket basket) { Guid userId = _fileManagerAuth.GetCurrentUserId(); try { Basket basketPrevious = _facade.GetBasketByResourceIdAndUserId(basket.ResourceId, userId); if (basketPrevious == null) { basket.UserId = userId; return _facade.AddBusket(basket); } } catch(Exception e) { } return false; }
public bool RemoveBasketResourceByBasket(Basket basket) { try { _db.Baskets.Remove(basket); _db.SaveChanges(); return true; } catch (Exception ex) { return false; } }