/// <summary> /// Method for updating role in database. /// </summary> /// <param name="item">Updating role</param> public void Update(Role item) { Role role = db.Roles.Find(item.Id); role.Name = item.Name; db.Entry(role).State = System.Data.Entity.EntityState.Modified; }
/// <summary> /// Method for updating tag in database. /// </summary> /// <param name="item">Updating tag</param> public void Update(Tag item) { var tag = db.Tags.Find(item.Id); tag.TagName = item.TagName; tag.MapObjects = item.MapObjects; db.Entry(tag).State = System.Data.Entity.EntityState.Modified; }
/// <summary> /// Method for updating user in database. /// </summary> /// <param name="item">Updating user</param> public void Update(User item) { User user = db.Users.Find(item.Id); user.Name = item.Name; user.Password = item.Password; user.Role = item.Role; user.RoleId = item.RoleId; db.Entry(user).State = EntityState.Modified; }
/// <summary> /// Method for updating object in database. /// </summary> /// <param name="item">Updating object</param> public void Update(MapObject item) { // If to update through db.Entry(tmp).State = EntityState.Modified // that we received an error "such object already exists". MapObject tmp = db.MapsObjects.Find(item.Id); tmp.ObjectName = item.ObjectName; tmp.Tags = item.Tags; tmp.GeoLong = item.GeoLong; tmp.GeoLat = item.GeoLat; tmp.Status = item.Status; tmp.IsDelete = item.IsDelete; db.Entry(tmp).State = EntityState.Modified; }