public bool DeleteHub(Models.Hubs.Hub hub) { if (hub == null) { return(false); } _unitOfWork.HubRepository.Delete(hub); _unitOfWork.Save(); return(true); }
public void CanEditPostBack() { //ACT var hub = new Models.Hubs.Hub { HubID = 1, Name = "Adama", HubOwnerID = 1 }; var jsonResult = _hubController.Edit(hub) as JsonResult; //ASSERT Assert.NotNull(jsonResult); dynamic data = jsonResult.Data; Assert.AreEqual(true, data.success); }
public void CanDoCreatePostBack() { //ACT var hub = new Models.Hubs.Hub { Name = "Diredawa", HubOwnerID = 1 }; var jsonResult = _hubController.Create(hub) as JsonResult; //ASSERT Assert.NotNull(jsonResult); dynamic data = jsonResult.Data; Assert.AreEqual(true, data.success); }
public List <Store> GetStoresWithBalanceOfCommodity(int parentCommodityId, int hubId) { Models.Hubs.Hub hub = FindHubById(hubId); List <Store> result = new List <Store>(); foreach (var store in hub.Stores) { var balance = (_unitOfWork.TransactionRepository.FindBy(s => s.StoreID == store.StoreID && parentCommodityId == s.ParentCommodityID && s.LedgerID == Cats.Models.Ledger.Constants.GOODS_ON_HAND).Select(q => q.QuantityInMT)); if (balance.Any() && balance.Sum() > 0) { result.Add(store); } } return(result); }
public bool EditHub(Models.Hubs.Hub hub) { _unitOfWork.HubRepository.Edit(hub); _unitOfWork.Save(); return(true); }
public bool AddHub(Models.Hubs.Hub hub) { _unitOfWork.HubRepository.Add(hub); _unitOfWork.Save(); return(true); }
public List <Models.Hubs.Hub> GetOthersWithDifferentOwner(Models.Hubs.Hub hub) { return((from v in _unitOfWork.HubRepository.GetAll() where v.HubOwnerID != hub.HubOwnerID select v).ToList()); }
public List <Models.Hubs.Hub> GetOthersHavingSameOwner(Models.Hubs.Hub hub) { return((from v in _unitOfWork.HubRepository.GetAll() where v.HubID != hub.HubID && v.HubOwnerID == hub.HubOwnerID select v).ToList()); }