public IHttpActionResult Save(StoreProxy proxy) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (proxy.Id == 0) { db.STORES.Add(new STORES { ADDRESS = proxy.Address, LOGO = proxy.Logo, NAME = proxy.Name }); } else { STORES row = db.STORES.Find(proxy.Id); row.ADDRESS = proxy.Address; row.LOGO = proxy.Logo; row.NAME = proxy.Name; } try { db.SaveChanges(); return(Ok()); } catch (Exception e) { string error = e.GetBaseException().ToString(); return(InternalServerError()); } }
public override void Execute(INotification notification) { base.Execute(notification); StoreProxy storeProxy = Facade.RetrieveProxy(nameof(StoreProxy)) as StoreProxy; storeProxy.RequestPurchaseItem(notification.Body as string); }
public override void Execute(INotification notification) { base.Execute(notification); StoreProxy storeProxy = Facade.RetrieveProxy(nameof(StoreProxy)) as StoreProxy; storeProxy.RequestStoreItemList(); }
public void Test() { var proxy = new StoreProxy(BaseAddress); var store = proxy.Get(Token, AppId).Result; var hash = proxy.Update(Token, AppId, new DiffModel { Hash = store.Hash, Store = "sssss", Start = 0, End = 0 }).Result; store = proxy.Get(Token, AppId).Result; Assert.AreEqual("sssss",store.Store); hash = proxy.Update(Token, AppId, new DiffModel { Hash = hash.Hash, Store = "fff", Start = 1, End = 2 }).Result; store = proxy.Get(Token, AppId).Result; Assert.AreEqual("sfffss", store.Store); store = proxy.Get(Token, AppId, hash.Hash).Result; Assert.IsNull(store); }
public override void Init() { var store = new AdministrationsStore(); var proxy = new StoreProxy(store); var start = new StartOptions(proxy); start.AddOption("--exit", parameters => StopProcessingInput()); options = start; base.Init(); }