Exemplo n.º 1
0
        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 StoreProxy(STORES store)
 {
     Id      = store.ID;
     Name    = store.NAME;
     Address = store.ADDRESS;
     Logo    = store.LOGO;
 }
 protected void btnCancel_Click(object sender, EventArgs e)
 {
     itemname.Value         = "";
     txtstock.Value         = "";
     txtReservedStock.Value = "";
     SafetyStock.Value      = "";
     STORES.DataBind();
     dsMaterials.DataBind();
 }
Exemplo n.º 4
0
        public IHttpActionResult Delete(int id)
        {
            STORES item = db.STORES.Find(id);

            if (item == null)
            {
                return(NotFound());
            }

            db.STORES.Remove(item);
            db.SaveChanges();

            return(Ok());
        }
        private async void buttonAdd_Click(object sender, EventArgs e)
        {
            if (textBoxAddress.Text == null || textBoxAddress.Text == "" ||
                textBoxCity.Text == null || textBoxAddress.Text == "")
            {
                MessageBox.Show("Заповнення усіх полів обов'язкове!", "Увага");
                return;
            }

            var store = new STORES
            {
                S_CITY    = textBoxCity.Text,
                S_ADDRESS = textBoxAddress.Text
            };

            string address = store.S_CITY + ", " + store.S_ADDRESS;

            (store.S_LATITUDE, store.S_LONGITUDE) = await LocationFromAddress(address);

            ctx.STORES.Add(store);
            ctx.SaveChanges();

            this.Close();
        }
Exemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AStore" /> class.
 /// </summary>
 /// <param name="name">name.</param>
 /// <param name="id">id.</param>
 /// <param name="store">store.</param>
 public AStore(string name = default(string), int?id = default(int?), STORES store = default(STORES))
 {
     this.Name  = name;
     this.Id    = id;
     this.Store = store;
 }