示例#1
0
        public void Update(int id, string city, string neigbour)
        {
            var model = addressesDb.GetById(id);

            model.City         = city;
            model.Neighborhood = neigbour;

            addressesDb.SaveChanges();
        }
示例#2
0
        public void Update(SportCenter entity, string city, string neighbour)
        {
            var model = sportCentersDb.GetById(entity.Id);

            model.Name                 = entity.Name;
            model.PhoneNumber          = entity.PhoneNumber;
            model.ExactAddress         = entity.ExactAddress;
            model.Address.City         = city;
            model.Address.Neighborhood = neighbour;
            model.Description          = entity.Description;

            sportCentersDb.Update(model);
            sportCentersDb.SaveChanges();
        }
示例#3
0
        public bool UpdateById(int id, string name)
        {
            var entity = sportCategoriesDb.GetById(id);

            if (entity == null)
            {
                return(false);
            }

            entity.Name = name;

            sportCategoriesDb.Update(entity);
            sportCategoriesDb.SaveChanges();

            return(true);
        }
示例#4
0
        public ActionResult Update([DataSourceRequest] DataSourceRequest request, PostsViewModel model)
        {
            if (this.ModelState.IsValid && model != null)
            {
                var post = _posts.GetById(model.Id);
                post.Title      = model.Title;
                post.Content    = model.Content;
                post.ModifiedOn = DateTime.UtcNow;

                this._posts.Update(post);
                this._posts.SaveChanges();
            }

            var postToDisplay = this._posts.All().Project().To <PostsViewModel>().First(x => x.Id == model.Id);

            return(Json(new[] { postToDisplay }.ToDataSourceResult(request, this.ModelState)));
        }