Exemplo n.º 1
0
 public ResultModel Update(UpdateMerchantModel model)
 {
     return(this._database.RunQuery(db =>
     {
         var result = new ResultModel();
         db.YH_MerchantInfo.Update(model);
         return result;
     }));
 }
Exemplo n.º 2
0
        public IHttpActionResult Put(int id, [FromBody] UpdateMerchantModel model)
        {
            var merchant = DB.Merchants.Find(id);

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

            if (model.Contact != null)
            {
                if (DB.Merchants.Any(x => x.Contact == model.Contact))
                {
                    return(BadRequest("Contact is already used!"));
                }

                merchant.Contact = model.Contact;
            }

            if (model.Location != null)
            {
                merchant.Location = model.Location;
            }

            if (model.LocationLat != null)
            {
                merchant.LocationLat = model.LocationLat.Value;
            }

            if (model.LocationLng != null)
            {
                merchant.LocationLng = model.LocationLng.Value;
            }

            if (model.Name != null)
            {
                merchant.Name = model.Name;
            }

            if (model.WorkingHours != null)
            {
                merchant.WorkingHours = model.WorkingHours;
            }

            if (model.SupportedNetworks != null)
            {
                merchant.SupportedNetworks = model.SupportedNetworks;
            }

            DB.SaveChanges();

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 3
0
 public static ApiEndpoint Update(int id, UpdateMerchantModel update) => new ApiEndpoint($"{BaseUrl}/{id}", HttpMethod.Put, update);
Exemplo n.º 4
0
        public JsonResult Update(UpdateMerchantModel model)
        {
            var result = this._merchantService.Update(model);

            return(this.Json(result));
        }